From 7e98987b5a913074c46ef343b36f867d10fa0ab9 Mon Sep 17 00:00:00 2001 From: Soatok Dreamseeker Date: Tue, 21 Apr 2020 05:00:13 -0400 Subject: [PATCH] Commit changes to bundled-libs after Zend->Laminas rename --- .../zend-db/.ci/mysql_fixtures.sh | 5 - .../zend-db/.ci/mysql_fixtures_travis.sh | 5 - .../zend-db/.ci/pgsql_fixtures.sh | 6 - .../zend-db/.ci/sqlsrv_fixtures.sh | 5 - .../zendframework/zend-db/CHANGELOG.md | 445 ----- bundled-libs/zendframework/zend-db/LICENSE.md | 27 - bundled-libs/zendframework/zend-db/README.md | 12 - .../zendframework/zend-db/composer.json | 73 - .../zend-db/docs/CODE_OF_CONDUCT.md | 43 - .../zend-db/docs/CONTRIBUTING.md | 189 --- .../zend-db/docs/ISSUE_TEMPLATE.md | 19 - .../zend-db/docs/PULL_REQUEST_TEMPLATE.md | 25 - .../zendframework/zend-db/docs/SUPPORT.md | 25 - .../zend-db/docs/book/adapter.md | 498 ------ .../zend-db/docs/book/index.html | 10 - .../zend-db/docs/book/metadata.md | 229 --- .../zend-db/docs/book/result-set.md | 157 -- .../zend-db/docs/book/row-gateway.md | 98 -- .../zend-db/docs/book/sql-ddl.md | 201 --- .../zendframework/zend-db/docs/book/sql.md | 741 -------- .../zend-db/docs/book/table-gateway.md | 217 --- bundled-libs/zendframework/zend-db/phpcs.xml | 11 - .../zend-db/src/Adapter/Adapter.php | 436 ----- .../Adapter/AdapterAbstractServiceFactory.php | 125 -- .../src/Adapter/AdapterAwareInterface.php | 21 - .../zend-db/src/Adapter/AdapterAwareTrait.php | 31 - .../zend-db/src/Adapter/AdapterInterface.php | 28 - .../src/Adapter/AdapterServiceFactory.php | 42 - .../src/Adapter/Driver/AbstractConnection.php | 135 -- .../Adapter/Driver/ConnectionInterface.php | 85 - .../src/Adapter/Driver/DriverInterface.php | 79 - .../Driver/Feature/AbstractFeature.php | 38 - .../Driver/Feature/DriverFeatureInterface.php | 37 - .../src/Adapter/Driver/IbmDb2/Connection.php | 285 ---- .../src/Adapter/Driver/IbmDb2/IbmDb2.php | 214 --- .../src/Adapter/Driver/IbmDb2/Result.php | 192 --- .../src/Adapter/Driver/IbmDb2/Statement.php | 277 --- .../src/Adapter/Driver/Mysqli/Connection.php | 285 ---- .../src/Adapter/Driver/Mysqli/Mysqli.php | 262 --- .../src/Adapter/Driver/Mysqli/Result.php | 342 ---- .../src/Adapter/Driver/Mysqli/Statement.php | 315 ---- .../src/Adapter/Driver/Oci8/Connection.php | 268 --- .../Driver/Oci8/Feature/RowCounter.php | 75 - .../zend-db/src/Adapter/Driver/Oci8/Oci8.php | 302 ---- .../src/Adapter/Driver/Oci8/Result.php | 231 --- .../src/Adapter/Driver/Oci8/Statement.php | 327 ---- .../src/Adapter/Driver/Pdo/Connection.php | 432 ----- .../Driver/Pdo/Feature/OracleRowCounter.php | 76 - .../Driver/Pdo/Feature/SqliteRowCounter.php | 76 - .../zend-db/src/Adapter/Driver/Pdo/Pdo.php | 331 ---- .../zend-db/src/Adapter/Driver/Pdo/Result.php | 254 --- .../src/Adapter/Driver/Pdo/Statement.php | 310 ---- .../src/Adapter/Driver/Pgsql/Connection.php | 313 ---- .../src/Adapter/Driver/Pgsql/Pgsql.php | 237 --- .../src/Adapter/Driver/Pgsql/Result.php | 192 --- .../src/Adapter/Driver/Pgsql/Statement.php | 242 --- .../src/Adapter/Driver/ResultInterface.php | 67 - .../src/Adapter/Driver/Sqlsrv/Connection.php | 289 ---- .../Sqlsrv/Exception/ErrorException.php | 32 - .../Sqlsrv/Exception/ExceptionInterface.php | 16 - .../src/Adapter/Driver/Sqlsrv/Result.php | 208 --- .../src/Adapter/Driver/Sqlsrv/Sqlsrv.php | 215 --- .../src/Adapter/Driver/Sqlsrv/Statement.php | 318 ---- .../src/Adapter/Driver/StatementInterface.php | 45 - .../src/Adapter/Exception/ErrorException.php | 16 - .../Adapter/Exception/ExceptionInterface.php | 16 - .../Exception/InvalidArgumentException.php | 16 - .../InvalidConnectionParametersException.php | 28 - .../Exception/InvalidQueryException.php | 14 - .../Adapter/Exception/RuntimeException.php | 16 - .../Exception/UnexpectedValueException.php | 16 - .../src/Adapter/ParameterContainer.php | 422 ----- .../src/Adapter/Platform/AbstractPlatform.php | 142 -- .../zend-db/src/Adapter/Platform/IbmDb2.php | 125 -- .../zend-db/src/Adapter/Platform/Mysql.php | 122 -- .../zend-db/src/Adapter/Platform/Oracle.php | 129 -- .../Adapter/Platform/PlatformInterface.php | 94 -- .../src/Adapter/Platform/Postgresql.php | 112 -- .../zend-db/src/Adapter/Platform/Sql92.php | 33 - .../src/Adapter/Platform/SqlServer.php | 119 -- .../zend-db/src/Adapter/Platform/Sqlite.php | 105 -- .../zend-db/src/Adapter/Profiler/Profiler.php | 89 - .../Profiler/ProfilerAwareInterface.php | 18 - .../Adapter/Profiler/ProfilerInterface.php | 20 - .../src/Adapter/StatementContainer.php | 71 - .../Adapter/StatementContainerInterface.php | 43 - .../zend-db/src/ConfigProvider.php | 43 - .../zend-db/src/Exception/ErrorException.php | 14 - .../src/Exception/ExceptionInterface.php | 14 - .../Exception/InvalidArgumentException.php | 14 - .../src/Exception/RuntimeException.php | 14 - .../Exception/UnexpectedValueException.php | 14 - .../zend-db/src/Metadata/Metadata.php | 161 -- .../src/Metadata/MetadataInterface.php | 154 -- .../Metadata/Object/AbstractTableObject.php | 114 -- .../src/Metadata/Object/ColumnObject.php | 388 ----- .../Metadata/Object/ConstraintKeyObject.php | 249 --- .../src/Metadata/Object/ConstraintObject.php | 411 ----- .../src/Metadata/Object/TableObject.php | 14 - .../src/Metadata/Object/TriggerObject.php | 448 ----- .../src/Metadata/Object/ViewObject.php | 76 - .../src/Metadata/Source/AbstractSource.php | 549 ------ .../zend-db/src/Metadata/Source/Factory.php | 47 - .../src/Metadata/Source/MysqlMetadata.php | 503 ------ .../src/Metadata/Source/OracleMetadata.php | 256 --- .../Metadata/Source/PostgresqlMetadata.php | 349 ---- .../src/Metadata/Source/SqlServerMetadata.php | 345 ---- .../src/Metadata/Source/SqliteMetadata.php | 387 ----- .../zendframework/zend-db/src/Module.php | 24 - .../src/ResultSet/AbstractResultSet.php | 291 ---- .../Exception/ExceptionInterface.php | 16 - .../Exception/InvalidArgumentException.php | 16 - .../ResultSet/Exception/RuntimeException.php | 16 - .../src/ResultSet/HydratingResultSet.php | 130 -- .../zend-db/src/ResultSet/ResultSet.php | 120 -- .../src/ResultSet/ResultSetInterface.php | 33 - .../src/RowGateway/AbstractRowGateway.php | 362 ---- .../Exception/ExceptionInterface.php | 16 - .../Exception/InvalidArgumentException.php | 16 - .../RowGateway/Exception/RuntimeException.php | 16 - .../RowGateway/Feature/AbstractFeature.php | 58 - .../src/RowGateway/Feature/FeatureSet.php | 161 -- .../zend-db/src/RowGateway/RowGateway.php | 50 - .../src/RowGateway/RowGatewayInterface.php | 16 - .../zend-db/src/Sql/AbstractExpression.php | 93 - .../zend-db/src/Sql/AbstractPreparableSql.php | 39 - .../zend-db/src/Sql/AbstractSql.php | 479 ------ .../zendframework/zend-db/src/Sql/Combine.php | 212 --- .../zend-db/src/Sql/Ddl/AlterTable.php | 238 --- .../Sql/Ddl/Column/AbstractLengthColumn.php | 71 - .../Ddl/Column/AbstractPrecisionColumn.php | 86 - .../Ddl/Column/AbstractTimestampColumn.php | 63 - .../zend-db/src/Sql/Ddl/Column/BigInteger.php | 18 - .../zend-db/src/Sql/Ddl/Column/Binary.php | 18 - .../zend-db/src/Sql/Ddl/Column/Blob.php | 18 - .../zend-db/src/Sql/Ddl/Column/Boolean.php | 31 - .../zend-db/src/Sql/Ddl/Column/Char.php | 18 - .../zend-db/src/Sql/Ddl/Column/Column.php | 196 --- .../src/Sql/Ddl/Column/ColumnInterface.php | 40 - .../zend-db/src/Sql/Ddl/Column/Date.php | 18 - .../zend-db/src/Sql/Ddl/Column/Datetime.php | 18 - .../zend-db/src/Sql/Ddl/Column/Decimal.php | 18 - .../zend-db/src/Sql/Ddl/Column/Float.php | 48 - .../zend-db/src/Sql/Ddl/Column/Floating.php | 24 - .../zend-db/src/Sql/Ddl/Column/Integer.php | 28 - .../zend-db/src/Sql/Ddl/Column/Text.php | 18 - .../zend-db/src/Sql/Ddl/Column/Time.php | 18 - .../zend-db/src/Sql/Ddl/Column/Timestamp.php | 18 - .../zend-db/src/Sql/Ddl/Column/Varbinary.php | 18 - .../zend-db/src/Sql/Ddl/Column/Varchar.php | 18 - .../Sql/Ddl/Constraint/AbstractConstraint.php | 130 -- .../zend-db/src/Sql/Ddl/Constraint/Check.php | 56 - .../Ddl/Constraint/ConstraintInterface.php | 17 - .../src/Sql/Ddl/Constraint/ForeignKey.php | 184 -- .../src/Sql/Ddl/Constraint/PrimaryKey.php | 18 - .../src/Sql/Ddl/Constraint/UniqueKey.php | 18 - .../zend-db/src/Sql/Ddl/CreateTable.php | 208 --- .../zend-db/src/Sql/Ddl/DropTable.php | 44 - .../src/Sql/Ddl/Index/AbstractIndex.php | 16 - .../zend-db/src/Sql/Ddl/Index/Index.php | 80 - .../zend-db/src/Sql/Ddl/SqlInterface.php | 16 - .../zendframework/zend-db/src/Sql/Delete.php | 172 -- .../src/Sql/Exception/ExceptionInterface.php | 16 - .../Exception/InvalidArgumentException.php | 16 - .../src/Sql/Exception/RuntimeException.php | 16 - .../zend-db/src/Sql/Expression.php | 164 -- .../zend-db/src/Sql/ExpressionInterface.php | 37 - .../zendframework/zend-db/src/Sql/Having.php | 14 - .../zendframework/zend-db/src/Sql/Insert.php | 300 ---- .../zendframework/zend-db/src/Sql/Join.php | 163 -- .../zendframework/zend-db/src/Sql/Literal.php | 56 - .../src/Sql/Platform/AbstractPlatform.php | 112 -- .../src/Sql/Platform/IbmDb2/IbmDb2.php | 23 - .../Sql/Platform/IbmDb2/SelectDecorator.php | 212 --- .../Mysql/Ddl/AlterTableDecorator.php | 251 --- .../Mysql/Ddl/CreateTableDecorator.php | 184 -- .../zend-db/src/Sql/Platform/Mysql/Mysql.php | 22 - .../Sql/Platform/Mysql/SelectDecorator.php | 77 - .../src/Sql/Platform/Oracle/Oracle.php | 20 - .../Sql/Platform/Oracle/SelectDecorator.php | 155 -- .../zend-db/src/Sql/Platform/Platform.php | 173 -- .../Platform/PlatformDecoratorInterface.php | 20 - .../SqlServer/Ddl/CreateTableDecorator.php | 45 - .../Platform/SqlServer/SelectDecorator.php | 128 -- .../src/Sql/Platform/SqlServer/SqlServer.php | 21 - .../Sql/Platform/Sqlite/SelectDecorator.php | 105 -- .../src/Sql/Platform/Sqlite/Sqlite.php | 25 - .../zend-db/src/Sql/Predicate/Between.php | 147 -- .../zend-db/src/Sql/Predicate/Expression.php | 30 - .../zend-db/src/Sql/Predicate/In.php | 140 -- .../zend-db/src/Sql/Predicate/IsNotNull.php | 15 - .../zend-db/src/Sql/Predicate/IsNull.php | 96 -- .../zend-db/src/Sql/Predicate/Like.php | 114 -- .../zend-db/src/Sql/Predicate/Literal.php | 16 - .../zend-db/src/Sql/Predicate/NotBetween.php | 15 - .../zend-db/src/Sql/Predicate/NotIn.php | 15 - .../zend-db/src/Sql/Predicate/NotLike.php | 15 - .../zend-db/src/Sql/Predicate/Operator.php | 270 --- .../zend-db/src/Sql/Predicate/Predicate.php | 455 ----- .../src/Sql/Predicate/PredicateInterface.php | 16 - .../src/Sql/Predicate/PredicateSet.php | 201 --- .../src/Sql/PreparableSqlInterface.php | 24 - .../zendframework/zend-db/src/Sql/Select.php | 836 --------- .../zendframework/zend-db/src/Sql/Sql.php | 174 -- .../zend-db/src/Sql/SqlInterface.php | 24 - .../zend-db/src/Sql/TableIdentifier.php | 113 -- .../zendframework/zend-db/src/Sql/Update.php | 277 --- .../zendframework/zend-db/src/Sql/Where.php | 14 - .../src/TableGateway/AbstractTableGateway.php | 544 ------ .../Exception/ExceptionInterface.php | 16 - .../Exception/InvalidArgumentException.php | 16 - .../Exception/RuntimeException.php | 16 - .../TableGateway/Feature/AbstractFeature.php | 57 - .../src/TableGateway/Feature/EventFeature.php | 257 --- .../EventFeature/TableGatewayEvent.php | 139 -- .../Feature/EventFeatureEventsInterface.php | 36 - .../src/TableGateway/Feature/FeatureSet.php | 172 -- .../Feature/GlobalAdapterFeature.php | 67 - .../Feature/MasterSlaveFeature.php | 91 - .../TableGateway/Feature/MetadataFeature.php | 85 - .../Feature/RowGatewayFeature.php | 78 - .../TableGateway/Feature/SequenceFeature.php | 133 -- .../zend-db/src/TableGateway/TableGateway.php | 83 - .../TableGateway/TableGatewayInterface.php | 19 - .../zendframework/zend-db/test/autoload.php | 26 - .../Adapter/Driver/Mysqli/ConnectionTest.php | 25 - .../Driver/Mysqli/TableGatewayTest.php | 50 - .../Adapter/Driver/Mysqli/TraitSetup.php | 43 - .../Adapter/Driver/Pdo/Mysql/AdapterTest.php | 20 - .../Adapter/Driver/Pdo/Mysql/AdapterTrait.php | 23 - .../Adapter/Driver/Pdo/Mysql/QueryTest.php | 57 - .../Driver/Pdo/Mysql/TableGatewayTest.php | 98 -- .../Adapter/Platform/MysqlTest.php | 75 - .../Adapter/Platform/PostgresqlTest.php | 75 - .../Adapter/Platform/SqlServerTest.php | 61 - .../Adapter/Platform/SqliteTest.php | 49 - .../integration/IntegrationTestListener.php | 62 - .../integration/Platform/FixtureLoader.php | 16 - .../Platform/MysqlFixtureLoader.php | 58 - .../Platform/PgsqlFixtureLoader.php | 76 - .../test/integration/TestFixtures/mysql.sql | 21 - .../test/integration/TestFixtures/pgsql.sql | 19 - .../AdapterAbstractServiceFactoryTest.php | 88 - .../unit/Adapter/AdapterAwareTraitTest.php | 32 - .../Adapter/AdapterServiceFactoryTest.php | 57 - .../zend-db/test/unit/Adapter/AdapterTest.php | 316 ---- .../Driver/IbmDb2/AbstractIntegrationTest.php | 44 - .../IbmDb2/ConnectionIntegrationTest.php | 213 --- .../Adapter/Driver/IbmDb2/ConnectionTest.php | 64 - .../Driver/IbmDb2/IbmDb2IntegrationTest.php | 55 - .../unit/Adapter/Driver/IbmDb2/IbmDb2Test.php | 166 -- .../Driver/IbmDb2/ResultIntegrationTest.php | 198 --- .../IbmDb2/StatementIntegrationTest.php | 134 -- .../Adapter/Driver/IbmDb2/StatementTest.php | 188 --- .../Driver/IbmDb2/TestAsset/Db2Functions.php | 57 - .../Adapter/Driver/Mysqli/ConnectionTest.php | 76 - .../Driver/Oci8/AbstractIntegrationTest.php | 41 - .../Driver/Oci8/ConnectionIntegrationTest.php | 180 -- .../Adapter/Driver/Oci8/ConnectionTest.php | 64 - .../Driver/Oci8/Feature/RowCounterTest.php | 113 -- .../Driver/Oci8/Oci8IntegrationTest.php | 50 - .../unit/Adapter/Driver/Oci8/Oci8Test.php | 166 -- .../Driver/Oci8/ResultIntegrationTest.php | 198 --- .../unit/Adapter/Driver/Oci8/ResultTest.php | 90 - .../Driver/Oci8/StatementIntegrationTest.php | 117 -- .../Adapter/Driver/Oci8/StatementTest.php | 161 -- .../Driver/Pdo/ConnectionIntegrationTest.php | 183 -- .../Adapter/Driver/Pdo/ConnectionTest.php | 123 -- .../Driver/Pdo/ConnectionTransactionsTest.php | 201 --- .../Pdo/Feature/OracleRowCounterTest.php | 133 -- .../Pdo/Feature/SqliteRowCounterTest.php | 133 -- .../test/unit/Adapter/Driver/Pdo/PdoTest.php | 87 - .../unit/Adapter/Driver/Pdo/ResultTest.php | 72 - .../Driver/Pdo/StatementIntegrationTest.php | 74 - .../unit/Adapter/Driver/Pdo/StatementTest.php | 131 -- .../Driver/Pdo/TestAsset/CtorlessPdo.php | 25 - .../Driver/Pdo/TestAsset/SqliteMemoryPdo.php | 31 - .../Adapter/Driver/Pgsql/ConnectionTest.php | 168 -- .../unit/Adapter/Driver/Pgsql/PgsqlTest.php | 178 -- .../Driver/Pgsql/pgsqlMockFunctions.php | 15 - .../Driver/Sqlsrv/AbstractIntegrationTest.php | 45 - .../Sqlsrv/ConnectionIntegrationTest.php | 192 --- .../Adapter/Driver/Sqlsrv/ConnectionTest.php | 64 - .../Sqlsrv/PdoSqlSrvIntegrationTest.php | 29 - .../Driver/Sqlsrv/ResultIntegrationTest.php | 198 --- .../Driver/Sqlsrv/SqlSrvIntegrationTest.php | 70 - .../unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php | 166 -- .../Sqlsrv/StatementIntegrationTest.php | 87 - .../Adapter/Driver/Sqlsrv/StatementTest.php | 138 -- .../unit/Adapter/Driver/TestAsset/PdoMock.php | 39 - .../unit/Adapter/ParameterContainerTest.php | 299 ---- .../test/unit/Adapter/Platform/IbmDb2Test.php | 196 --- .../test/unit/Adapter/Platform/MysqlTest.php | 242 --- .../test/unit/Adapter/Platform/OracleTest.php | 256 --- .../unit/Adapter/Platform/PostgresqlTest.php | 184 -- .../test/unit/Adapter/Platform/Sql92Test.php | 176 -- .../unit/Adapter/Platform/SqlServerTest.php | 194 --- .../test/unit/Adapter/Platform/SqliteTest.php | 206 --- .../unit/Adapter/Platform/_files/.gitkeep | 0 .../unit/Adapter/Profiler/ProfilerTest.php | 89 - .../zend-db/test/unit/ConfigProviderTest.php | 42 - .../Metadata/Source/AbstractSourceTest.php | 80 - .../test/unit/Metadata/Source/FactoryTest.php | 65 - .../Metadata/Source/OracleMetadataTest.php | 55 - .../Metadata/Source/SqliteMetadataTest.php | 102 -- .../AbstractResultSetIntegrationTest.php | 58 - .../unit/ResultSet/AbstractResultSetTest.php | 271 --- .../HydratingResultSetIntegrationTest.php | 33 - .../unit/ResultSet/HydratingResultSetTest.php | 102 -- .../ResultSet/ResultSetIntegrationTest.php | 251 --- .../RowGateway/AbstractRowGatewayTest.php | 316 ---- .../test/unit/RowGateway/RowGatewayTest.php | 49 - .../zend-db/test/unit/Sql/AbstractSqlTest.php | 187 --- .../zend-db/test/unit/Sql/CombineTest.php | 213 --- .../test/unit/Sql/Ddl/AlterTableTest.php | 122 -- .../Ddl/Column/AbstractLengthColumnTest.php | 48 - .../Column/AbstractPrecisionColumnTest.php | 68 - .../unit/Sql/Ddl/Column/BigIntegerTest.php | 37 - .../test/unit/Sql/Ddl/Column/BinaryTest.php | 28 - .../test/unit/Sql/Ddl/Column/BlobTest.php | 28 - .../test/unit/Sql/Ddl/Column/BooleanTest.php | 44 - .../test/unit/Sql/Ddl/Column/CharTest.php | 28 - .../test/unit/Sql/Ddl/Column/ColumnTest.php | 132 -- .../test/unit/Sql/Ddl/Column/DateTest.php | 28 - .../test/unit/Sql/Ddl/Column/DatetimeTest.php | 28 - .../test/unit/Sql/Ddl/Column/DecimalTest.php | 28 - .../test/unit/Sql/Ddl/Column/FloatTest.php | 29 - .../test/unit/Sql/Ddl/Column/FloatingTest.php | 32 - .../test/unit/Sql/Ddl/Column/IntegerTest.php | 49 - .../test/unit/Sql/Ddl/Column/TextTest.php | 28 - .../test/unit/Sql/Ddl/Column/TimeTest.php | 28 - .../unit/Sql/Ddl/Column/TimestampTest.php | 28 - .../unit/Sql/Ddl/Column/VarbinaryTest.php | 28 - .../test/unit/Sql/Ddl/Column/VarcharTest.php | 38 - .../Ddl/Constraint/AbstractConstraintTest.php | 50 - .../unit/Sql/Ddl/Constraint/CheckTest.php | 32 - .../Sql/Ddl/Constraint/ForeignKeyTest.php | 134 -- .../Sql/Ddl/Constraint/PrimaryKeyTest.php | 32 - .../unit/Sql/Ddl/Constraint/UniqueKeyTest.php | 32 - .../test/unit/Sql/Ddl/CreateTableTest.php | 175 -- .../test/unit/Sql/Ddl/DropTableTest.php | 32 - .../test/unit/Sql/Ddl/Index/IndexTest.php | 64 - .../zend-db/test/unit/Sql/DeleteTest.php | 228 --- .../zend-db/test/unit/Sql/ExpressionTest.php | 182 -- .../zend-db/test/unit/Sql/InsertTest.php | 412 ----- .../zend-db/test/unit/Sql/JoinTest.php | 135 -- .../zend-db/test/unit/Sql/LiteralTest.php | 47 - .../Platform/IbmDb2/SelectDecoratorTest.php | 155 -- .../Mysql/Ddl/AlterTableDecoratorTest.php | 55 - .../Mysql/Ddl/CreateTableDecoratorTest.php | 57 - .../unit/Sql/Platform/Mysql/MysqlTest.php | 31 - .../Platform/Mysql/SelectDecoratorTest.php | 249 --- .../unit/Sql/Platform/Oracle/OracleTest.php | 31 - .../Platform/Oracle/SelectDecoratorTest.php | 144 -- .../test/unit/Sql/Platform/PlatformTest.php | 126 -- .../Ddl/CreateTableDecoratorTest.php | 46 - .../SqlServer/SelectDecoratorTest.php | 142 -- .../Sql/Platform/SqlServer/SqlServerTest.php | 31 - .../Platform/Sqlite/SelectDecoratorTest.php | 160 -- .../unit/Sql/Platform/Sqlite/SqliteTest.php | 31 - .../test/unit/Sql/Predicate/BetweenTest.php | 139 -- .../unit/Sql/Predicate/ExpressionTest.php | 183 -- .../test/unit/Sql/Predicate/InTest.php | 127 -- .../test/unit/Sql/Predicate/IsNullTest.php | 61 - .../test/unit/Sql/Predicate/LikeTest.php | 68 - .../test/unit/Sql/Predicate/LiteralTest.php | 34 - .../unit/Sql/Predicate/NotBetweenTest.php | 60 - .../test/unit/Sql/Predicate/NotInTest.php | 66 - .../test/unit/Sql/Predicate/NotLikeTest.php | 64 - .../test/unit/Sql/Predicate/OperatorTest.php | 103 -- .../unit/Sql/Predicate/PredicateSetTest.php | 133 -- .../test/unit/Sql/Predicate/PredicateTest.php | 287 ---- .../zend-db/test/unit/Sql/SelectTest.php | 1490 ----------------- .../test/unit/Sql/SqlFunctionalTest.php | 624 ------- .../zend-db/test/unit/Sql/SqlTest.php | 237 --- .../test/unit/Sql/TableIdentifierTest.php | 118 -- .../zend-db/test/unit/Sql/UpdateTest.php | 429 ----- .../TableGateway/AbstractTableGatewayTest.php | 425 ----- .../TableGateway/Feature/EventFeatureTest.php | 246 --- .../TableGateway/Feature/FeatureSetTest.php | 176 -- .../Feature/MasterSlaveFeatureTest.php | 101 -- .../Feature/MetadataFeatureTest.php | 125 -- .../Feature/SequenceFeatureTest.php | 98 -- .../unit/TableGateway/TableGatewayTest.php | 263 --- .../test/unit/TestAsset/ConnectionWrapper.php | 28 - .../test/unit/TestAsset/DeleteDecorator.php | 27 - .../test/unit/TestAsset/DeleteIgnore.php | 26 - .../test/unit/TestAsset/InsertDecorator.php | 27 - .../test/unit/TestAsset/PdoStubDriver.php | 24 - .../zend-db/test/unit/TestAsset/Replace.php | 26 - .../test/unit/TestAsset/SelectDecorator.php | 27 - .../unit/TestAsset/TemporaryResultSet.php | 7 - .../unit/TestAsset/TrustingMysqlPlatform.php | 20 - .../unit/TestAsset/TrustingOraclePlatform.php | 20 - .../unit/TestAsset/TrustingSql92Platform.php | 23 - .../TestAsset/TrustingSqlServerPlatform.php | 20 - .../test/unit/TestAsset/UpdateDecorator.php | 27 - .../test/unit/TestAsset/UpdateIgnore.php | 27 - .../zendframework/zend-stdlib/CHANGELOG.md | 385 ----- .../zendframework/zend-stdlib/LICENSE.md | 27 - .../zendframework/zend-stdlib/README.md | 29 - .../benchmark/ExtractPriorityQueueBench.php | 54 - .../benchmark/InsertPriorityQueueBench.php | 47 - .../benchmark/RemovePriorityQueueBench.php | 46 - .../zendframework/zend-stdlib/composer.json | 56 - .../zend-stdlib/docs/CODE_OF_CONDUCT.md | 43 - .../zend-stdlib/docs/CONTRIBUTING.md | 189 --- .../zend-stdlib/docs/ISSUE_TEMPLATE.md | 19 - .../zend-stdlib/docs/PULL_REQUEST_TEMPLATE.md | 25 - .../zendframework/zend-stdlib/docs/SUPPORT.md | 25 - .../zend-stdlib/docs/book/console-helper.md | 126 -- .../zend-stdlib/docs/book/index.html | 10 - .../zend-stdlib/docs/book/migration.md | 60 - .../zend-stdlib/docs/bookdown.json | 14 - .../zend-stdlib/src/AbstractOptions.php | 178 -- .../zend-stdlib/src/ArrayObject.php | 434 ----- .../src/ArraySerializableInterface.php | 28 - .../zend-stdlib/src/ArrayStack.php | 33 - .../zend-stdlib/src/ArrayUtils.php | 314 ---- .../src/ArrayUtils/MergeRemoveKey.php | 14 - .../src/ArrayUtils/MergeReplaceKey.php | 34 - .../ArrayUtils/MergeReplaceKeyInterface.php | 21 - .../zend-stdlib/src/ConsoleHelper.php | 158 -- .../zend-stdlib/src/DispatchableInterface.php | 22 - .../zend-stdlib/src/ErrorHandler.php | 115 -- .../src/Exception/BadMethodCallException.php | 17 - .../src/Exception/DomainException.php | 17 - .../src/Exception/ExceptionInterface.php | 17 - .../Exception/ExtensionNotLoadedException.php | 17 - .../Exception/InvalidArgumentException.php | 17 - .../src/Exception/LogicException.php | 17 - .../src/Exception/RuntimeException.php | 17 - .../zend-stdlib/src/FastPriorityQueue.php | 371 ---- .../zendframework/zend-stdlib/src/Glob.php | 202 --- .../zend-stdlib/src/Guard/AllGuardsTrait.php | 20 - .../Guard/ArrayOrTraversableGuardTrait.php | 41 - .../zend-stdlib/src/Guard/EmptyGuardTrait.php | 35 - .../zend-stdlib/src/Guard/NullGuardTrait.php | 35 - .../src/InitializableInterface.php | 23 - .../zend-stdlib/src/JsonSerializable.php | 17 - .../zendframework/zend-stdlib/src/Message.php | 118 -- .../zend-stdlib/src/MessageInterface.php | 44 - .../src/ParameterObjectInterface.php | 38 - .../zend-stdlib/src/Parameters.php | 115 -- .../zend-stdlib/src/ParametersInterface.php | 86 - .../zend-stdlib/src/PriorityList.php | 274 --- .../zend-stdlib/src/PriorityQueue.php | 301 ---- .../zendframework/zend-stdlib/src/Request.php | 15 - .../zend-stdlib/src/RequestInterface.php | 14 - .../zend-stdlib/src/Response.php | 15 - .../zend-stdlib/src/ResponseInterface.php | 14 - .../zend-stdlib/src/SplPriorityQueue.php | 93 - .../zend-stdlib/src/SplQueue.php | 55 - .../zend-stdlib/src/SplStack.php | 55 - .../zend-stdlib/src/StringUtils.php | 187 --- .../StringWrapper/AbstractStringWrapper.php | 269 --- .../zend-stdlib/src/StringWrapper/Iconv.php | 289 ---- .../zend-stdlib/src/StringWrapper/Intl.php | 88 - .../src/StringWrapper/MbString.php | 121 -- .../zend-stdlib/src/StringWrapper/Native.php | 134 -- .../StringWrapper/StringWrapperInterface.php | 111 -- .../zend-stdlib/test/ArrayObjectTest.php | 389 ----- .../zend-stdlib/test/ArrayUtilsTest.php | 521 ------ .../zend-stdlib/test/ConsoleHelperTest.php | 148 -- .../zend-stdlib/test/ErrorHandlerTest.php | 105 -- .../test/FastPriorityQueueTest.php | 348 ---- .../zend-stdlib/test/GlobTest.php | 73 - .../ArrayOrTraversableGuardTraitTest.php | 42 - .../test/Guard/EmptyGuardTraitTest.php | 34 - .../test/Guard/NullGuardTraitTest.php | 35 - .../zend-stdlib/test/MessageTest.php | 73 - .../zend-stdlib/test/OptionsTest.php | 205 --- .../zend-stdlib/test/ParametersTest.php | 63 - .../zend-stdlib/test/PriorityListTest.php | 244 --- .../zend-stdlib/test/PriorityQueueTest.php | 164 -- .../zend-stdlib/test/SplPriorityQueueTest.php | 73 - .../zend-stdlib/test/SplQueueTest.php | 50 - .../zend-stdlib/test/SplStackTest.php | 52 - .../zend-stdlib/test/StringUtilsTest.php | 160 -- .../StringWrapper/CommonStringWrapperTest.php | 264 --- .../test/StringWrapper/IconvTest.php | 46 - .../test/StringWrapper/IntlTest.php | 46 - .../test/StringWrapper/MbStringTest.php | 46 - .../test/StringWrapper/NativeTest.php | 31 - .../test/TestAsset/ArrayObjectIterator.php | 51 - .../test/TestAsset/ArrayObjectObjectCount.php | 18 - .../test/TestAsset/ArrayObjectObjectVars.php | 17 - .../test/TestAsset/ArraySerializable.php | 49 - .../test/TestAsset/GuardedObject.php | 32 - .../test/TestAsset/TestOptions.php | 86 - .../test/TestAsset/TestOptionsDerived.php | 72 - .../test/TestAsset/TestOptionsNoStrict.php | 34 - .../TestAsset/TestOptionsWithoutGetter.php | 25 - .../zend-stdlib/test/_files/alpha | 0 .../zend-stdlib/test/_files/beta | 0 .../zend-stdlib/test/_files/delta | 0 .../zend-stdlib/test/_files/eta.alpha | 0 .../zend-stdlib/test/_files/eta.beta | 0 .../zend-stdlib/test/_files/gamma | 0 .../zend-stdlib/test/_files/zeta.alpha | 0 .../zend-stdlib/test/_files/zeta.beta | 0 501 files changed, 57840 deletions(-) delete mode 100644 bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh delete mode 100644 bundled-libs/zendframework/zend-db/.ci/mysql_fixtures_travis.sh delete mode 100644 bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh delete mode 100644 bundled-libs/zendframework/zend-db/.ci/sqlsrv_fixtures.sh delete mode 100644 bundled-libs/zendframework/zend-db/CHANGELOG.md delete mode 100644 bundled-libs/zendframework/zend-db/LICENSE.md delete mode 100644 bundled-libs/zendframework/zend-db/README.md delete mode 100644 bundled-libs/zendframework/zend-db/composer.json delete mode 100644 bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/PULL_REQUEST_TEMPLATE.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/SUPPORT.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/adapter.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/index.html delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/metadata.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/result-set.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/row-gateway.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/sql.md delete mode 100644 bundled-libs/zendframework/zend-db/docs/book/table-gateway.md delete mode 100644 bundled-libs/zendframework/zend-db/phpcs.xml delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Adapter.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/AdapterAwareTrait.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/AdapterInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/DriverInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Feature/AbstractFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Connection.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Result.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/ErrorException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidConnectionParametersException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Exception/UnexpectedValueException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/ParameterContainer.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/Mysql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/Oracle.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/Postgresql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sql92.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/SqlServer.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sqlite.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Profiler/Profiler.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/Profiler/ProfilerInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/StatementContainer.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Adapter/StatementContainerInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ConfigProvider.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Exception/ErrorException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Exception/UnexpectedValueException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Metadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/MetadataInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/AbstractTableObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/ColumnObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/TableObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/TriggerObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Object/ViewObject.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/AbstractSource.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/Factory.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Module.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/AbstractResultSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/HydratingResultSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/ResultSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/ResultSet/ResultSetInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/AbstractRowGateway.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/Feature/AbstractFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/RowGateway.php delete mode 100644 bundled-libs/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/AbstractExpression.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/AbstractPreparableSql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/AbstractSql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Combine.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/AlterTable.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Binary.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Blob.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Boolean.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Char.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Column.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Date.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Datetime.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Decimal.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Float.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Floating.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Integer.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Text.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Time.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Timestamp.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Varbinary.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Varchar.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/AbstractConstraint.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/ForeignKey.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/UniqueKey.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/CreateTable.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/DropTable.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/Index/Index.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Delete.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Expression.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/ExpressionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Having.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Insert.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Join.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Literal.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Platform.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Between.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Expression.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/In.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/IsNull.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Like.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Literal.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/NotBetween.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/NotIn.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/NotLike.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Operator.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/Predicate.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Predicate/PredicateSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/PreparableSqlInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Select.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Sql.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/SqlInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/TableIdentifier.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Update.php delete mode 100644 bundled-libs/zendframework/zend-db/src/Sql/Where.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/AbstractFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/FeatureSet.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/TableGateway.php delete mode 100644 bundled-libs/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php delete mode 100644 bundled-libs/zendframework/zend-db/test/autoload.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TableGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TraitSetup.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTrait.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/TableGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/MysqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/PostgresqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqlServerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqliteTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/IntegrationTestListener.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Platform/FixtureLoader.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Platform/MysqlFixtureLoader.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/Platform/PgsqlFixtureLoader.php delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/TestFixtures/mysql.sql delete mode 100644 bundled-libs/zendframework/zend-db/test/integration/TestFixtures/pgsql.sql delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAbstractServiceFactoryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAwareTraitTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterServiceFactoryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/AbstractIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2IntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2Test.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ResultIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/TestAsset/Db2Functions.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Mysqli/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/AbstractIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Feature/RowCounterTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8IntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8Test.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTransactionsTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/OracleRowCounterTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/SqliteRowCounterTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/PdoTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ResultTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/CtorlessPdo.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/PgsqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/pgsqlMockFunctions.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/AbstractIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/PdoSqlSrvIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ResultIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlSrvIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/TestAsset/PdoMock.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/ParameterContainerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/IbmDb2Test.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/MysqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/OracleTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/PostgresqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/Sql92Test.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqlServerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqliteTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/_files/.gitkeep delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Adapter/Profiler/ProfilerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ConfigProviderTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/AbstractSourceTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/FactoryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/OracleMetadataTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/SqliteMetadataTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/ResultSet/ResultSetIntegrationTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/RowGateway/AbstractRowGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/RowGateway/RowGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/AbstractSqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/CombineTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/AlterTableTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractLengthColumnTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractPrecisionColumnTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BigIntegerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BinaryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BlobTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BooleanTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/CharTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/ColumnTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DateTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DatetimeTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DecimalTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatingTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/IntegerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TextTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimeTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimestampTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarbinaryTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarcharTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/CheckTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/ForeignKeyTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/PrimaryKeyTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/UniqueKeyTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/CreateTableTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/DropTableTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Index/IndexTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/DeleteTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/ExpressionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/InsertTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/JoinTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/LiteralTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/IbmDb2/SelectDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/AlterTableDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/CreateTableDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/MysqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/SelectDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/OracleTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/SelectDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/PlatformTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/Ddl/CreateTableDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SelectDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SqlServerTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SelectDecoratorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SqliteTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/BetweenTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/ExpressionTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/InTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/IsNullTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LikeTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LiteralTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotBetweenTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotInTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotLikeTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/OperatorTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateSetTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/SelectTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/SqlFunctionalTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/SqlTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/TableIdentifierTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/Sql/UpdateTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/AbstractTableGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/EventFeatureTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/FeatureSetTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MasterSlaveFeatureTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MetadataFeatureTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/SequenceFeatureTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TableGateway/TableGatewayTest.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/ConnectionWrapper.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteIgnore.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/InsertDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/PdoStubDriver.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/Replace.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/SelectDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/TemporaryResultSet.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingMysqlPlatform.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingOraclePlatform.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSql92Platform.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSqlServerPlatform.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateDecorator.php delete mode 100644 bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateIgnore.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/CHANGELOG.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/LICENSE.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/README.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/benchmark/ExtractPriorityQueueBench.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/benchmark/InsertPriorityQueueBench.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/benchmark/RemovePriorityQueueBench.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/composer.json delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/CODE_OF_CONDUCT.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/CONTRIBUTING.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/ISSUE_TEMPLATE.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/PULL_REQUEST_TEMPLATE.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/SUPPORT.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/book/console-helper.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/book/index.html delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/book/migration.md delete mode 100644 bundled-libs/zendframework/zend-stdlib/docs/bookdown.json delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/AbstractOptions.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayObject.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArraySerializableInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayStack.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayUtils.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ConsoleHelper.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/DispatchableInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ErrorHandler.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/DomainException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/LogicException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Exception/RuntimeException.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/FastPriorityQueue.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Glob.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/InitializableInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/JsonSerializable.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Message.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/MessageInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ParameterObjectInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Parameters.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ParametersInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/PriorityList.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/PriorityQueue.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Request.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/RequestInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/Response.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/ResponseInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/SplPriorityQueue.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/SplQueue.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/SplStack.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringUtils.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Iconv.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Intl.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/MbString.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Native.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/ArrayObjectTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/ArrayUtilsTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/ConsoleHelperTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/ErrorHandlerTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/FastPriorityQueueTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/GlobTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/Guard/ArrayOrTraversableGuardTraitTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/Guard/EmptyGuardTraitTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/Guard/NullGuardTraitTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/MessageTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/OptionsTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/ParametersTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/PriorityListTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/PriorityQueueTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/SplPriorityQueueTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/SplQueueTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/SplStackTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringUtilsTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringWrapper/CommonStringWrapperTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IconvTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IntlTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringWrapper/MbStringTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/StringWrapper/NativeTest.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectIterator.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectObjectCount.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectObjectVars.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArraySerializable.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/GuardedObject.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptions.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsDerived.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsNoStrict.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsWithoutGetter.php delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/alpha delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/beta delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/delta delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/eta.alpha delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/eta.beta delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/gamma delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/zeta.alpha delete mode 100644 bundled-libs/zendframework/zend-stdlib/test/_files/zeta.beta diff --git a/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh b/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh deleted file mode 100644 index 625903e8..00000000 --- a/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -echo "Configure MySQL test database" - -mysql --user=root --password=Password123 -e 'create database zenddb_test;' diff --git a/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures_travis.sh b/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures_travis.sh deleted file mode 100644 index b769ef74..00000000 --- a/bundled-libs/zendframework/zend-db/.ci/mysql_fixtures_travis.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -echo "Configure MySQL test database" - -mysql -u root -e 'create database zenddb_test;' diff --git a/bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh b/bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh deleted file mode 100644 index c9cf42be..00000000 --- a/bundled-libs/zendframework/zend-db/.ci/pgsql_fixtures.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -echo "Configure PostgreSQL test database" - -psql -U postgres -c 'create database zenddb_test;' -psql -U postgres -c "alter role postgres password 'postgres'" diff --git a/bundled-libs/zendframework/zend-db/.ci/sqlsrv_fixtures.sh b/bundled-libs/zendframework/zend-db/.ci/sqlsrv_fixtures.sh deleted file mode 100644 index 58074cb3..00000000 --- a/bundled-libs/zendframework/zend-db/.ci/sqlsrv_fixtures.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -echo "Configure SQL server test database" - -sqlcmd -S localhost -U sa -P Password123 -Q "CREATE DATABASE zenddb_test;" diff --git a/bundled-libs/zendframework/zend-db/CHANGELOG.md b/bundled-libs/zendframework/zend-db/CHANGELOG.md deleted file mode 100644 index a0d05c7f..00000000 --- a/bundled-libs/zendframework/zend-db/CHANGELOG.md +++ /dev/null @@ -1,445 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file, in reverse chronological order by release. - -## 2.10.0 - 2019-02-25 - -### Added - -- [#157](https://github.com/zendframework/zend-db/pull/157) added support of - `Zend\Db\Sql\TableIdentifier` in DDL -- [#345](https://github.com/zendframework/zend-db/pull/345) allow usage with - zend-hydrator v3 -- [#346](https://github.com/zendframework/zend-db/pull/346) adds support for PHP - 7.3 - -### Changed - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#303](https://github.com/zendframework/zend-db/pull/303) fixes #295 issue: - handle empty array as datasource at `AbstractResultSet::initialize()` at PHP - 7.2 -- [#313](https://github.com/zendframework/zend-db/pull/313) test - `AbstractResultSet::current()` to return null on empty array -- [#329](https://github.com/zendframework/zend-db/pull/329) fixes Exception - thrown when calling `prepareStatementForSqlObject` on a Select with a - sub-Select that has limit and/or offset set -- [#337](https://github.com/zendframework/zend-db/pull/337) fixes #330 current - NULL for mysqli -- [#338](https://github.com/zendframework/zend-db/pull/338) restore missing use - `ResultSet` in `AbstractTableGateway` -- [#341](https://github.com/zendframework/zend-db/pull/341) fixes undefined - variable bug in MetadataFeature -- [#357](https://github.com/zendframework/zend-db/pull/357) fixes named params - in subquery - limit and offset (issue #355) - -## 2.9.3 - 2018-04-09 - -### Added - -- Nothing. - -### Changed - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#295](https://github.com/zendframework/zend-db/pull/295) fix error when - datasource passed to `AbstractResultSet::initialize()` is empty array at - php 7.2 environment - -- [#300](https://github.com/zendframework/zend-db/pull/300) Fix error for nested - queries inside field parameters - -- [#301](https://github.com/zendframework/zend-db/pull/301) fix for issue with - set fields that exists in different tables in one query - -- [#304](https://github.com/zendframework/zend-db/pull/304) fix PDO bind - parameter name to use field name with extended charset (PDO only supports - alphanumeric and underscore for placeholder/parameter names). - -## 2.9.2 - 2017-12-11 - -### Added - -- Nothing. - -### Changed - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#292](https://github.com/zendframework/zend-db/pull/292) ensures that you may - reference bound parameter names using a leading colon (`:`) character when - using the PDO adapter. (The leading colon is not technically necessary, as the - adapter will prefix for you; however, this ensures portability with vanilla - PDO.) - -## 2.9.1 - 2017-12-07 - -### Added - -- Nothing. - -### Changed - -- [#289](https://github.com/zendframework/zend-db/pull/289) reverts a change - introduced in 2.9.0 and modifies the behavior of the PDO adapter slightly - to remove a regression. In 2.9.0, when binding parameters with names that - contained characters not supported by PDO, we would pass the parameter names - to `md5()`; this caused a regression, as the SQL string containing the - parameter name was not also updated. - - This patch modifies the behavior during a bind-operation to instead raise an - exception if a parameter name contains characters not supported by PDO. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.9.0 - 2017-12-06 - -### Added - -- [#216](https://github.com/zendframework/zend-db/pull/216) added AFTER support - in ALTER TABLE syntax for MySQL -- [#223](https://github.com/zendframework/zend-db/pull/223) added support for - empty values set with IN predicate -- [#271](https://github.com/zendframework/zend-db/pull/271) added support for - dash character on MySQL identifier -- [#273](https://github.com/zendframework/zend-db/pull/273) added support for - implementing an error handler for db2_prepare -- [#275](https://github.com/zendframework/zend-db/pull/275) added support for - LIMIT OFFSET for db2 -- [#280](https://github.com/zendframework/zend-db/pull/280) added version dsn - parameter for pdo_dblib - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#205](https://github.com/zendframework/zend-db/pull/205) fixes the spaces in - ORDER BY syntax -- [#224](https://github.com/zendframework/zend-db/pull/224) fixes how parameters - are bound to statements in the PDO adapter. PDO has a restriction on parameter - names of `[0-9a-zA_Z_]`; as such, the driver now hashes the parameter names - using `md5()` in order to ensure compatibility with other drivers. -- [#229](https://github.com/zendframework/zend-db/pull/229) fixes the support - of SSL for mysqli -- [#255](https://github.com/zendframework/zend-db/pull/255) fixes ResultSet with - array values -- [#261](https://github.com/zendframework/zend-db/pull/261) fixes Exception in - Firebird driver doesn't support lastInsertId -- [#276](https://github.com/zendframework/zend-db/pull/276) fixes the support - of PHP 7.2 -- [#287](https://github.com/zendframework/zend-db/pull/287) fixes the usage of - count() with PHP 7.2 - -## 2.8.2 - 2016-08-09 - -### Added - -- [#110](https://github.com/zendframework/zend-db/pull/110) prepared the - documentation for publication at https://zendframework.github.io/zend-db/ -- [#114](https://github.com/zendframework/zend-db/pull/114) add - Adapter\Adapter::class to alias against Adapter\AdapterInterface::class - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#154](https://github.com/zendframework/zend-db/pull/154) fixes the how the - COMBINE operator is applied to SQLite adapters, ensuring a valid UNION - statement is generated. -- [#112](https://github.com/zendframework/zend-db/pull/112) fixes the test on - the number of replacements when using the same variable name. -- [#115](https://github.com/zendframework/zend-db/pull/115) TableGateway update - method was incorrect when specifying default join declaration. -- [#145](https://github.com/zendframework/zend-db/pull/145) Fix MSSQL Select - when encounting DISTINCT and OFFSET and LIMIT together. -- [#153](https://github.com/zendframework/zend-db/pull/153) Runtime exception - threw fatal error due to incorrect spelling of the class when a DSN did not - exist. - -## 2.8.1 - 2016-04-14 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#100](https://github.com/zendframework/zend-db/pull/100) fixes the JOIN - behavior to re-allow selecting an empty column set from the joined table. -- [#106](https://github.com/zendframework/zend-db/pull/106) fixes an issue in - the test suite when ext/pgsql is enabled, but no databases are avaiable. - -## 2.8.0 - 2016-04-12 - -### Added - -- [#92](https://github.com/zendframework/zend-db/pull/92) adds the class - `Zend\Db\Sql\Join` for creating and aggregating JOIN specifications. This is - now consumed by all `Zend\Db\Sql` implementations in order to represent JOIN - statements. -- [#92](https://github.com/zendframework/zend-db/pull/92) adds support for JOIN - operations to UPDATE statements. -- [#92](https://github.com/zendframework/zend-db/pull/92) adds support for joins - to `AbstractTableGateway::update`; you can now pass an array of - specifications via a third argument to the method. -- [#96](https://github.com/zendframework/zend-db/pull/96) exposes the package as - config-provider/component, but adding: - - `Zend\Db\ConfigProvider`, which maps the `AdapterInterface` to the - `AdapterServiceFactory`, and enables the `AdapterAbstractServiceFactory`. - - `Zend\Db\Module`, which does the same, for a zend-mvc context. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.7.1 - 2016-04-12 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#71](https://github.com/zendframework/zend-db/pull/71) updates the `Pgsql` - adapter to allow passing the connection charset; this can be done with the - `charset` option when creating your adapter. -- [#76](https://github.com/zendframework/zend-db/pull/76) fixes the behavior of - `Zend\Db\Sql\Insert` when an array of names is used for columns to ensure the - string names are used, and not the array indices. -- [#91](https://github.com/zendframework/zend-db/pull/91) fixes the behavior of - the `Oci8` adapter when initializing a result set; previously, it was - improperly assigning the count of affected rows to the generated value. -- [#95](https://github.com/zendframework/zend-db/pull/95) fixes the `IbmDb2` - platform's `quoteIdentifier()` method to properly allow `#` characters in - identifiers (as they are commonly used on that platform). - -## 2.7.0 - 2016-02-22 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#85](https://github.com/zendframework/zend-db/pull/85) and - [#87](https://github.com/zendframework/zend-db/pull/87) update the code base - to be forwards compatible with: - - zend-eventmanager v3 - - zend-hydrator v2.1 - - zend-servicemanager v3 - - zend-stdlib v3 - -## 2.6.2 - 2015-12-09 - -### Added - -- [#49](https://github.com/zendframework/zend-db/pull/49) Add docbook - documentation. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#55](https://github.com/zendframework/zend-db/pull/55) Implement FeatureSet - canCallMagicCall and callMagicCall methods -- [#56](https://github.com/zendframework/zend-db/pull/56) - AbstractResultSet::current now does validation to ensure an array. -- [#58](https://github.com/zendframework/zend-db/pull/58) Fix unbuffered result - on MySQLi. -- [#59](https://github.com/zendframework/zend-db/pull/59) Allow unix_socket - parameter - -## 2.6.1 - 2015-10-14 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#31](https://github.com/zendframework/zend-db/pull/31) fixes table gateway - update when there is a table alias utilized. - -## 2.6.1 - 2015-10-14 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#43](https://github.com/zendframework/zend-db/pull/43) unset and get during - an insert operation would throw an InvalidArgumentException during an insert. - -## 2.6.0 - 2015-09-22 - -### Added - -- [#42](https://github.com/zendframework/zend-db/pull/42) updates the component - to use zend-hydrator for hydrator functionality; this provides forward - compatibility with zend-hydrator, and backwards compatibility with - hydrators from older versions of zend-stdlib. -- [#15](https://github.com/zendframework/zend-db/pull/15) adds a new predicate, - `Zend\Db\Sql\Predicate\NotBetween`, which can be invoked via `Sql` - instances: `$sql->notBetween($field, $min, $max)`. -- [#22](https://github.com/zendframework/zend-db/pull/22) extracts a factory, - `Zend\Db\Metadata\Source\Factory`, from `Zend\Db\Metadata\Metadata`, - removing the (non-public) `createSourceFromAdapter()` method from that - class. Additionally, it extracts `Zend\Db\Metadata\MetadataInterface`, to - allow creating alternate implementations. - -### Deprecated - -- [#27](https://github.com/zendframework/zend-db/pull/27) deprecates the - constants `JOIN_OUTER_LEFT` and `JOIN_OUTER_RIGHT` in favor of - `JOIN_LEFT_OUTER` and `JOIN_RIGHT_OUTER`. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.5.2 - 2015-09-22 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- [#29](https://github.com/zendframework/zend-db/pull/29) removes the required - second argument to `Zend\Db\Predicate\Predicate::expression()`, allowing it to - be nullable, and mirroring the constructor of `Zend\Db\Predicate\Expression`. - -### Fixed - -- [#40](https://github.com/zendframework/zend-db/pull/40) updates the - zend-stdlib dependency to reference `>=2.5.0,<2.7.0` to ensure hydrators - will work as expected following extraction of hydrators to the zend-hydrator - repository. -- [#34](https://github.com/zendframework/zend-db/pull/34) fixes retrieval of - constraint metadata in the Oracle adapter. -- [#41](https://github.com/zendframework/zend-db/pull/41) removes hard dependency - on EventManager in AbstractTableGateway. -- [#17](https://github.com/zendframework/zend-db/pull/17) removes an executable - bit on a regular file. -- [#3](https://github.com/zendframework/zend-db/pull/3) updates the code to use - closure binding (now that we're on 5.5+, this is possible). -- [#9](https://github.com/zendframework/zend-db/pull/9) thoroughly audits the - OCI8 (Oracle) driver, ensuring it provides feature parity with other drivers, - and fixes issues with subselects, limits, and offsets. diff --git a/bundled-libs/zendframework/zend-db/LICENSE.md b/bundled-libs/zendframework/zend-db/LICENSE.md deleted file mode 100644 index 63df4102..00000000 --- a/bundled-libs/zendframework/zend-db/LICENSE.md +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2005-2017, Zend Technologies USA, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -- Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -- Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bundled-libs/zendframework/zend-db/README.md b/bundled-libs/zendframework/zend-db/README.md deleted file mode 100644 index 0b1243d6..00000000 --- a/bundled-libs/zendframework/zend-db/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# zend-db - -[![Build Status](https://secure.travis-ci.org/zendframework/zend-db.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-db) -[![Coverage Status](https://coveralls.io/repos/github/zendframework/zend-db/badge.svg?branch=master)](https://coveralls.io/github/zendframework/zend-db?branch=master) - -`Zend\Db` is a component that abstract the access to a Database using an object -oriented API to build the queries. `Zend\Db` consumes different storage adapters -to access different database vendors such as MySQL, PostgreSQL, Oracle, IBM DB2, -Microsoft Sql Server, PDO, etc. - -- File issues at https://github.com/zendframework/zend-db/issues -- Documentation is at https://docs.zendframework.com/zend-db/ diff --git a/bundled-libs/zendframework/zend-db/composer.json b/bundled-libs/zendframework/zend-db/composer.json deleted file mode 100644 index 5f75f916..00000000 --- a/bundled-libs/zendframework/zend-db/composer.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "zendframework/zend-db", - "description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations", - "license": "BSD-3-Clause", - "keywords": [ - "zf", - "zendframework", - "db" - ], - "support": { - "docs": "https://docs.zendframework.com/zend-db/", - "issues": "https://github.com/zendframework/zend-db/issues", - "source": "https://github.com/zendframework/zend-db", - "rss": "https://github.com/zendframework/zend-db/releases.atom", - "slack": "https://zendframework-slack.herokuapp.com", - "forum": "https://discourse.zendframework.com/c/questions/components" - }, - "require": { - "php": "^5.6 || ^7.0", - "zendframework/zend-stdlib": "^2.7 || ^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.25 || ^6.4.4", - "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", - "zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" - }, - "suggest": { - "zendframework/zend-eventmanager": "Zend\\EventManager component", - "zendframework/zend-hydrator": "Zend\\Hydrator component for using HydratingResultSets", - "zendframework/zend-servicemanager": "Zend\\ServiceManager component" - }, - "autoload": { - "psr-4": { - "Zend\\Db\\": "src/" - } - }, - "autoload-dev": { - "files": [ - "test/autoload.php" - ], - "psr-4": { - "ZendTest\\Db\\": "test/unit", - "ZendIntegrationTest\\Db\\": "test/integration" - } - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "2.9-dev", - "dev-develop": "2.10-dev" - }, - "zf": { - "component": "Zend\\Db", - "config-provider": "Zend\\Db\\ConfigProvider" - } - }, - "scripts": { - "check": [ - "@cs-check", - "@test" - ], - "cs-check": "phpcs", - "cs-fix": "phpcbf", - "test": "phpunit --colors=always --testsuite \"unit test\"", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", - "test-integration" : "phpunit --colors=always --testsuite \"integration test\"", - "upload-coverage": "coveralls -v" - } -} diff --git a/bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md b/bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md deleted file mode 100644 index 02fafcd1..00000000 --- a/bundled-libs/zendframework/zend-db/docs/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -This project adheres to [The Code Manifesto](http://codemanifesto.com) -as its guidelines for contributor interactions. - -## The Code Manifesto - -We want to work in an ecosystem that empowers developers to reach their -potential — one that encourages growth and effective collaboration. A space that -is safe for all. - -A space such as this benefits everyone that participates in it. It encourages -new developers to enter our field. It is through discussion and collaboration -that we grow, and through growth that we improve. - -In the effort to create such a place, we hold to these values: - -1. **Discrimination limits us.** This includes discrimination on the basis of - race, gender, sexual orientation, gender identity, age, nationality, technology - and any other arbitrary exclusion of a group of people. -2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort - levels. Remember that, and if brought to your attention, heed it. -3. **We are our biggest assets.** None of us were born masters of our trade. - Each of us has been helped along the way. Return that favor, when and where - you can. -4. **We are resources for the future.** As an extension of #3, share what you - know. Make yourself a resource to help those that come after you. -5. **Respect defines us.** Treat others as you wish to be treated. Make your - discussions, criticisms and debates from a position of respectfulness. Ask - yourself, is it true? Is it necessary? Is it constructive? Anything less is - unacceptable. -6. **Reactions require grace.** Angry responses are valid, but abusive language - and vindictive actions are toxic. When something happens that offends you, - handle it assertively, but be respectful. Escalate reasonably, and try to - allow the offender an opportunity to explain themselves, and possibly correct - the issue. -7. **Opinions are just that: opinions.** Each and every one of us, due to our - background and upbringing, have varying opinions. The fact of the matter, is - that is perfectly acceptable. Remember this: if you respect your own - opinions, you should respect the opinions of others. -8. **To err is human.** You might not intend it, but mistakes do happen and - contribute to build experience. Tolerate honest mistakes, and don't hesitate - to apologize if you make one yourself. diff --git a/bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md b/bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md deleted file mode 100644 index 3d7e856d..00000000 --- a/bundled-libs/zendframework/zend-db/docs/CONTRIBUTING.md +++ /dev/null @@ -1,189 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to this project, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zend-coding-standard) - - [Forums](https://discourse.zendframework.com/c/contributors) - - [Slack](https://zendframework-slack.herokuapp.com) - - [Code of Conduct](CODE_OF_CONDUCT.md) - -If you are working on new features or refactoring -[create a proposal](https://github.com/zendframework/zend-db/issues/new). - -## RUNNING TESTS - -To run tests: - -- Clone the repository: - - ```console - $ git clone git://github.com/zendframework/zend-db.git - $ cd zend-db - ``` - -- Install dependencies via composer: - - ```console - $ composer install - ``` - - If you don't have `composer` installed, please download it from https://getcomposer.org/download/ - -- Run the tests using the "test" command shipped in the `composer.json`: - - ```console - $ composer test - ``` - -You can turn on conditional tests with the `phpunit.xml` file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -First, ensure you've installed dependencies via composer, per the previous -section on running tests. - -To run CS checks only: - -```console -$ composer cs-check -``` - -To attempt to automatically fix common CS issues: - -```console -$ composer cs-fix -``` - -If the above fixes any CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](https://github.com/), if you haven't yet -2. Fork the repository (https://github.com/zendframework/zend-db) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com/zendframework/zend-db.git - $ cd zend-db - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-db.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-db.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" (or whatever the upstream organization is) as the recipient. - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d - ``` - -- Remote branch removal - - ```console - $ git push {username} : - ``` diff --git a/bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md b/bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md deleted file mode 100644 index de7f91a4..00000000 --- a/bundled-libs/zendframework/zend-db/docs/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,19 +0,0 @@ - - [ ] I was not able to find an [open](https://github.com/zendframework/zend-db/issues?q=is%3Aopen) or [closed](https://github.com/zendframework/zend-db/issues?q=is%3Aclosed) issue matching what I'm seeing. - - [ ] This is not a question. (Questions should be asked on [slack](https://zendframework.slack.com/) ([Signup for Slack here](https://zendframework-slack.herokuapp.com/)) or our [forums](https://discourse.zendframework.com/).) - -Provide a narrative description of what you are trying to accomplish. - -### Code to reproduce the issue - - - -```php -``` - -### Expected results - - - -### Actual results - - diff --git a/bundled-libs/zendframework/zend-db/docs/PULL_REQUEST_TEMPLATE.md b/bundled-libs/zendframework/zend-db/docs/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f00d90c0..00000000 --- a/bundled-libs/zendframework/zend-db/docs/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,25 +0,0 @@ -Provide a narrative description of what you are trying to accomplish: - -- [ ] Are you fixing a bug? - - [ ] Detail how the bug is invoked currently. - - [ ] Detail the original, incorrect behavior. - - [ ] Detail the new, expected behavior. - - [ ] Base your feature on the `master` branch, and submit against that branch. - - [ ] Add a regression test that demonstrates the bug, and proves the fix. - - [ ] Add a `CHANGELOG.md` entry for the fix. - -- [ ] Are you creating a new feature? - - [ ] Why is the new feature needed? What purpose does it serve? - - [ ] How will users use the new feature? - - [ ] Base your feature on the `develop` branch, and submit against that branch. - - [ ] Add only one feature per pull request; split multiple features over multiple pull requests - - [ ] Add tests for the new feature. - - [ ] Add documentation for the new feature. - - [ ] Add a `CHANGELOG.md` entry for the new feature. - -- [ ] Is this related to quality assurance? - - -- [ ] Is this related to documentation? - - diff --git a/bundled-libs/zendframework/zend-db/docs/SUPPORT.md b/bundled-libs/zendframework/zend-db/docs/SUPPORT.md deleted file mode 100644 index b5c6d8a0..00000000 --- a/bundled-libs/zendframework/zend-db/docs/SUPPORT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Getting Support - -Zend Framework offers three support channels: - -- For real-time questions, use our - [Slack](https://zendframework-slack.herokuapp.com) -- For detailed questions (e.g., those requiring examples) use our - [forums](https://discourse.zendframework.com/c/questions/components) -- To report issues, use this repository's - [issue tracker](https://github.com/zendframework/zend-db/issues/new) - -**DO NOT** use the issue tracker to ask questions; use Slack or the forums for -that. Questions posed to the issue tracker will be closed. - -When reporting an issue, please include the following details: - -- A narrative description of what you are trying to accomplish. -- The minimum code necessary to reproduce the issue. -- The expected results of exercising that code. -- The actual results received. - -We may ask for additional details: what version of the library you are using, -and what PHP version was used to reproduce the issue. - -You may also submit a failing test case as a pull request. diff --git a/bundled-libs/zendframework/zend-db/docs/book/adapter.md b/bundled-libs/zendframework/zend-db/docs/book/adapter.md deleted file mode 100644 index 857e12d9..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/adapter.md +++ /dev/null @@ -1,498 +0,0 @@ -# Adapters - -`Zend\Db\Adapter\Adapter` is the central object of the zend-db component. It is -responsible for adapting any code written in or for zend-db to the targeted PHP -extensions and vendor databases. In doing this, it creates an abstraction layer -for the PHP extensions in the `Driver` subnamespace of `Zend\Db\Adapter`. It -also creates a lightweight "Platform" abstraction layer, for the various -idiosyncrasies that each vendor-specific platform might have in its SQL/RDBMS -implementation, separate from the driver implementations. - -## Creating an adapter using configuration - -Create an adapter by instantiating the `Zend\Db\Adapter\Adapter` class. The most -common use case, while not the most explicit, is to pass an array of -configuration to the `Adapter`: - -```php -use Zend\Db\Adapter\Adapter; - -$adapter = new Adapter($configArray); -``` - -This driver array is an abstraction for the extension level required parameters. -Here is a table for the key-value pairs that should be in configuration array. - -Key | Is Required? | Value ----------- | ---------------------- | ----- -`driver` | required | `Mysqli`, `Sqlsrv`, `Pdo_Sqlite`, `Pdo_Mysql`, `Pdo`(= Other PDO Driver) -`database` | generally required | the name of the database (schema) -`username` | generally required | the connection username -`password` | generally required | the connection password -`hostname` | not generally required | the IP address or hostname to connect to -`port` | not generally required | the port to connect to (if applicable) -`charset` | not generally required | the character set to use - -> ### Options are adapter-dependent -> -> Other names will work as well. Effectively, if the PHP manual uses a -> particular naming, this naming will be supported by the associated driver. For -> example, `dbname` in most cases will also work for 'database'. Another -> example is that in the case of `Sqlsrv`, `UID` will work in place of -> `username`. Which format you choose is up to you, but the above table -> represents the official abstraction names. - -For example, a MySQL connection using ext/mysqli: - -```php -$adapter = new Zend\Db\Adapter\Adapter([ - 'driver' => 'Mysqli', - 'database' => 'zend_db_example', - 'username' => 'developer', - 'password' => 'developer-password', -]); -``` - -Another example, of a Sqlite connection via PDO: - -```php -$adapter = new Zend\Db\Adapter\Adapter([ - 'driver' => 'Pdo_Sqlite', - 'database' => 'path/to/sqlite.db', -]); -``` - -Another example, of an IBM i DB2 connection via IbmDb2: - -```php -$adapter = new Zend\Db\Adapter\Adapter([ - 'database' => '*LOCAL', // or name from WRKRDBDIRE, may be serial # - 'driver' => 'IbmDb2', - 'driver_options' => [ - 'autocommit' => DB2_AUTOCOMMIT_ON, - 'i5_naming' => DB2_I5_NAMING_ON, - 'i5_libl' => 'SCHEMA1 SCHEMA2 SCHEMA3', - ], - 'username' => '__USER__', - 'password' => '__PASS__', - // 'persistent' => true, - 'platform' => 'IbmDb2', - 'platform_options' => ['quote_identifiers' => false], -]); -``` - -Another example, of an IBM i DB2 connection via PDO: - -```php -$adapter = new Zend\Db\Adapter\Adapter([ - 'dsn' => 'ibm:DB_NAME', // DB_NAME is from WRKRDBDIRE, may be serial # - 'driver' => 'pdo', - 'driver_options' => [ - // PDO::ATTR_PERSISTENT => true, - PDO::ATTR_AUTOCOMMIT => true, - PDO::I5_ATTR_DBC_SYS_NAMING => true, - PDO::I5_ATTR_DBC_CURLIB => '', - PDO::I5_ATTR_DBC_LIBL => 'SCHEMA1 SCHEMA2 SCHEMA3', - ], - 'username' => '__USER__', - 'password' => '__PASS__', - 'platform' => 'IbmDb2', - 'platform_options' => ['quote_identifiers' => false], -]); -``` - -It is important to know that by using this style of adapter creation, the -`Adapter` will attempt to create any dependencies that were not explicitly -provided. A `Driver` object will be created from the configuration array -provided in the constructor. A `Platform` object will be created based off the -type of `Driver` class that was instantiated. And lastly, a default `ResultSet` -object is created and utilized. Any of these objects can be injected, to do -this, see the next section. - -The list of officially supported drivers: - -- `IbmDb2`: The ext/ibm_db2 driver -- `Mysqli`: The ext/mysqli driver -- `Oci8`: The ext/oci8 driver -- `Pgsql`: The ext/pgsql driver -- `Sqlsrv`: The ext/sqlsrv driver (from Microsoft) -- `Pdo_Mysql`: MySQL via the PDO extension -- `Pdo_Sqlite`: SQLite via the PDO extension -- `Pdo_Pgsql`: PostgreSQL via the PDO extension - -## Creating an adapter using dependency injection - -The more expressive and explicit way of creating an adapter is by injecting all -your dependencies up front. `Zend\Db\Adapter\Adapter` uses constructor -injection, and all required dependencies are injected through the constructor, -which has the following signature (in pseudo-code): - -```php -use Zend\Db\Adapter\Platform\PlatformInterface; -use Zend\Db\ResultSet\ResultSet; - -class Zend\Db\Adapter\Adapter -{ - public function __construct( - $driver, - PlatformInterface $platform = null, - ResultSet $queryResultSetPrototype = null - ); -} -``` - -What can be injected: - -- `$driver`: an array of connection parameters (see above) or an instance of - `Zend\Db\Adapter\Driver\DriverInterface`. -- `$platform` (optional): an instance of `Zend\Db\Platform\PlatformInterface`; - the default will be created based off the driver implementation. -- `$queryResultSetPrototype` (optional): an instance of - `Zend\Db\ResultSet\ResultSet`; to understand this object's role, see the - section below on querying. - -## Query Preparation - -By default, `Zend\Db\Adapter\Adapter::query()` prefers that you use -"preparation" as a means for processing SQL statements. This generally means -that you will supply a SQL statement containing placeholders for the values, and -separately provide substitutions for those placeholders. As an example: - -```php -$adapter->query('SELECT * FROM `artist` WHERE `id` = ?', [5]); -``` - -The above example will go through the following steps: - -- create a new `Statement` object. -- prepare the array `[5]` into a `ParameterContainer` if necessary. -- inject the `ParameterContainer` into the `Statement` object. -- execute the `Statement` object, producing a `Result` object. -- check the `Result` object to check if the supplied SQL was a result set - producing statement: - - if the query produced a result set, clone the `ResultSet` prototype, - inject the `Result` as its datasource, and return the new `ResultSet` - instance. - - otherwise, return the `Result`. - -## Query Execution - -In some cases, you have to execute statements directly without preparation. One -possible reason for doing so would be to execute a DDL statement, as most -extensions and RDBMS systems are incapable of preparing such statements. - -To execute a query without the preparation step, you will need to pass a flag as -the second argument indicating execution is required: - -```php -$adapter->query( - 'ALTER TABLE ADD INDEX(`foo_index`) ON (`foo_column`)', - Adapter::QUERY_MODE_EXECUTE -); -``` - -The primary difference to notice is that you must provide the -`Adapter::QUERY_MODE_EXECUTE` (execute) flag as the second parameter. - -## Creating Statements - -While `query()` is highly useful for one-off and quick querying of a database -via the `Adapter`, it generally makes more sense to create a statement and -interact with it directly, so that you have greater control over the -prepare-then-execute workflow. To do this, `Adapter` gives you a routine called -`createStatement()` that allows you to create a `Driver` specific `Statement` to -use so you can manage your own prepare-then-execute workflow. - -```php -// with optional parameters to bind up-front: -$statement = $adapter->createStatement($sql, $optionalParameters); -$result = $statement->execute(); -``` - -## Using the Driver Object - -The `Driver` object is the primary place where `Zend\Db\Adapter\Adapter` -implements the connection level abstraction specific to a given extension. To -make this possible, each driver is composed of 3 objects: - -- A connection: `Zend\Db\Adapter\Driver\ConnectionInterface` -- A statement: `Zend\Db\Adapter\Driver\StatementInterface` -- A result: `Zend\Db\Adapter\Driver\ResultInterface` - -Each of the built-in drivers practice "prototyping" as a means of creating -objects when new instances are requested. The workflow looks like this: - -- An adapter is created with a set of connection parameters. -- The adapter chooses the proper driver to instantiate (for example, - `Zend\Db\Adapter\Driver\Mysqli`) -- That driver class is instantiated. -- If no connection, statement, or result objects are injected, defaults are - instantiated. - -This driver is now ready to be called on when particular workflows are -requested. Here is what the `Driver` API looks like: - -```php -namespace Zend\Db\Adapter\Driver; - -interface DriverInterface -{ - const PARAMETERIZATION_POSITIONAL = 'positional'; - const PARAMETERIZATION_NAMED = 'named'; - const NAME_FORMAT_CAMELCASE = 'camelCase'; - const NAME_FORMAT_NATURAL = 'natural'; - - public function getDatabasePlatformName(string $nameFormat = self::NAME_FORMAT_CAMELCASE) : string; - public function checkEnvironment() : bool; - public function getConnection() : ConnectionInterface; - public function createStatement(string|resource $sqlOrResource = null) : StatementInterface; - public function createResult(resource $resource) : ResultInterface; - public function getPrepareType() :string; - public function formatParameterName(string $name, $type = null) : string; - public function getLastGeneratedValue() : mixed; -} -``` - -From this `DriverInterface`, you can - -- Determine the name of the platform this driver supports (useful for choosing - the proper platform object). -- Check that the environment can support this driver. -- Return the `Connection` instance. -- Create a `Statement` instance which is optionally seeded by an SQL statement - (this will generally be a clone of a prototypical statement object). -- Create a `Result` object which is optionally seeded by a statement resource - (this will generally be a clone of a prototypical result object) -- Format parameter names; this is important to distinguish the difference - between the various ways parameters are named between extensions -- Retrieve the overall last generated value (such as an auto-increment value). - -Now let's turn to the `Statement` API: - -```php -namespace Zend\Db\Adapter\Driver; - -interface StatementInterface extends StatementContainerInterface -{ - public function getResource() : resource; - public function prepare($sql = null) : void; - public function isPrepared() : bool; - public function execute(null|array|ParameterContainer $parameters = null) : ResultInterface; - - /** Inherited from StatementContainerInterface */ - public function setSql(string $sql) : void; - public function getSql() : string; - public function setParameterContainer(ParameterContainer $parameterContainer) : void; - public function getParameterContainer() : ParameterContainer; -} -``` - -And finally, the `Result` API: - -```php -namespace Zend\Db\Adapter\Driver; - -use Countable; -use Iterator; - -interface ResultInterface extends Countable, Iterator -{ - public function buffer() : void; - public function isQueryResult() : bool; - public function getAffectedRows() : int; - public function getGeneratedValue() : mixed; - public function getResource() : resource; - public function getFieldCount() : int; -} -``` - -## Using The Platform Object - -The `Platform` object provides an API to assist in crafting queries in a way -that is specific to the SQL implementation of a particular vendor. The object -handles nuances such as how identifiers or values are quoted, or what the -identifier separator character is. To get an idea of the capabilities, the -interface for a platform object looks like this: - -```php -namespace Zend\Db\Adapter\Platform; - -interface PlatformInterface -{ - public function getName() : string; - public function getQuoteIdentifierSymbol() : string; - public function quoteIdentifier(string $identifier) : string; - public function quoteIdentifierChain(string|string[] $identiferChain) : string; - public function getQuoteValueSymbol() : string; - public function quoteValue(string $value) : string; - public function quoteTrustedValue(string $value) : string; - public function quoteValueList(string|string[] $valueList) : string; - public function getIdentifierSeparator() : string; - public function quoteIdentifierInFragment(string $identifier, array $additionalSafeWords = []) : string; -} -``` - -While you can directly instantiate a `Platform` object, generally speaking, it -is easier to get the proper `Platform` instance from the configured adapter (by -default the `Platform` type will match the underlying driver implementation): - -```php -$platform = $adapter->getPlatform(); - -// or -$platform = $adapter->platform; // magic property access -``` - -The following are examples of `Platform` usage: - -```php -// $adapter is a Zend\Db\Adapter\Adapter instance; -// $platform is a Zend\Db\Adapter\Platform\Sql92 instance. -$platform = $adapter->getPlatform(); - -// "first_name" -echo $platform->quoteIdentifier('first_name'); - -// " -echo $platform->getQuoteIdentifierSymbol(); - -// "schema"."mytable" -echo $platform->quoteIdentifierChain(['schema', 'mytable']); - -// ' -echo $platform->getQuoteValueSymbol(); - -// 'myvalue' -echo $platform->quoteValue('myvalue'); - -// 'value', 'Foo O\\'Bar' -echo $platform->quoteValueList(['value', "Foo O'Bar"]); - -// . -echo $platform->getIdentifierSeparator(); - -// "foo" as "bar" -echo $platform->quoteIdentifierInFragment('foo as bar'); - -// additionally, with some safe words: -// ("foo"."bar" = "boo"."baz") -echo $platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']); -``` - -## Using The Parameter Container - -The `ParameterContainer` object is a container for the various parameters that -need to be passed into a `Statement` object to fulfill all the various -parameterized parts of the SQL statement. This object implements the -`ArrayAccess` interface. Below is the `ParameterContainer` API: - -```php -namespace Zend\Db\Adapter; - -use ArrayAccess; -use ArrayIterator; -use Countable; -use Iterator; - -class ParameterContainer implements Iterator, ArrayAccess, Countable -{ - public function __construct(array $data = []) - - /** methods to interact with values */ - public function offsetExists(string|int $name) : bool; - public function offsetGet(string|int $name) : mixed; - public function offsetSetReference(string|int $name, string|int $from) : void; - public function offsetSet(string|int $name, mixed $value, mixed $errata = null, int $maxLength = null) : void; - public function offsetUnset(string|int $name) : void; - - /** set values from array (will reset first) */ - public function setFromArray(array $data) : ParameterContainer; - - /** methods to interact with value errata */ - public function offsetSetErrata(string|int $name, mixed $errata) : void; - public function offsetGetErrata(string|int $name) : mixed; - public function offsetHasErrata(string|int $name) : bool; - public function offsetUnsetErrata(string|int $name) : void; - - /** errata only iterator */ - public function getErrataIterator() : ArrayIterator; - - /** get array with named keys */ - public function getNamedArray() : array; - - /** get array with int keys, ordered by position */ - public function getPositionalArray() : array; - - /** iterator: */ - public function count() : int; - public function current() : mixed; - public function next() : mixed; - public function key() : string|int; - public function valid() : bool; - public function rewind() : void; - - /** merge existing array of parameters with existing parameters */ - public function merge(array $parameters) : ParameterContainer; -} -``` - -In addition to handling parameter names and values, the container will assist in -tracking parameter types for PHP type to SQL type handling. For example, it -might be important that: - -```php -$container->offsetSet('limit', 5); -``` - -be bound as an integer. To achieve this, pass in the -`ParameterContainer::TYPE_INTEGER` constant as the 3rd parameter: - -```php -$container->offsetSet('limit', 5, $container::TYPE_INTEGER); -``` - -This will ensure that if the underlying driver supports typing of bound -parameters, that this translated information will also be passed along to the -actual php database driver. - -## Examples - -Creating a `Driver`, a vendor-portable query, and preparing and iterating the -result: - -```php -$adapter = new Zend\Db\Adapter\Adapter($driverConfig); - -$qi = function ($name) use ($adapter) { - return $adapter->platform->quoteIdentifier($name); -}; -$fp = function ($name) use ($adapter) { - return $adapter->driver->formatParameterName($name); -}; - -$sql = 'UPDATE ' . $qi('artist') - . ' SET ' . $qi('name') . ' = ' . $fp('name') - . ' WHERE ' . $qi('id') . ' = ' . $fp('id'); - -$statement = $adapter->query($sql); - -$parameters = [ - 'name' => 'Updated Artist', - 'id' => 1, -]; - -$statement->execute($parameters); - -// DATA INSERTED, NOW CHECK - -$statement = $adapter->query( - 'SELECT * FROM ' - . $qi('artist') - . ' WHERE id = ' . $fp('id') -); - -$results = $statement->execute(['id' => 1]); - -$row = $results->current(); -$name = $row['name']; -``` diff --git a/bundled-libs/zendframework/zend-db/docs/book/index.html b/bundled-libs/zendframework/zend-db/docs/book/index.html deleted file mode 100644 index c248f91b..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
-

zend-db

- -

Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations.

- -
$ composer require zendframework/zend-db
-
-
- diff --git a/bundled-libs/zendframework/zend-db/docs/book/metadata.md b/bundled-libs/zendframework/zend-db/docs/book/metadata.md deleted file mode 100644 index e1f5b31c..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/metadata.md +++ /dev/null @@ -1,229 +0,0 @@ -# RDBMS Metadata - -`Zend\Db\Metadata` is as sub-component of zend-db that makes it possible to get -metadata information about tables, columns, constraints, triggers, and other -information from a database in a standardized way. The primary interface for -`Metadata` is: - -```php -namespace Zend\Db\Metadata; - -interface MetadataInterface -{ - public function getSchemas(); - - public function getTableNames(string $schema = null, bool $includeViews = false) : string[]; - public function getTables(string $schema = null, bool $includeViews = false) : Object\TableObject[]; - public function getTable(string $tableName, string $schema = null) : Object\TableObject; - - public function getViewNames(string $schema = null) : string[]; - public function getViews(string $schema = null) : Object\ViewObject[]; - public function getView(string $viewName, string $schema = null) : Object\ViewObject; - - public function getColumnNames(string string $table, $schema = null) : string[]; - public function getColumns(string $table, string $schema = null) : Object\ColumnObject[]; - public function getColumn(string $columnName, string $table, string $schema = null) Object\ColumnObject; - - public function getConstraints(string $table, $string schema = null) : Object\ConstraintObject[]; - public function getConstraint(string $constraintName, string $table, string $schema = null) : Object\ConstraintObject; - public function getConstraintKeys(string $constraint, string $table, string $schema = null) : Object\ConstraintKeyObject[]; - - public function getTriggerNames(string $schema = null) : string[]; - public function getTriggers(string $schema = null) : Object\TriggerObject[]; - public function getTrigger(string $triggerName, string $schema = null) : Object\TriggerObject; -} -``` - -## Basic Usage - -Usage of `Zend\Db\Metadata` involves: - -- Constructing a `Zend\Db\Metadata\Metadata` instance with an `Adapter`. -- Choosing a strategy for retrieving metadata, based on the database platform - used. In most cases, information will come from querying the - `INFORMATION_SCHEMA` tables for the currently accessible schema. - -The `Metadata::get*Names()` methods will return arrays of strings, while the -other methods will return value objects specific to the type queried. - -```php -$metadata = new Zend\Db\Metadata\Metadata($adapter); - -// get the table names -$tableNames = $metadata->getTableNames(); - -foreach ($tableNames as $tableName) { - echo 'In Table ' . $tableName . PHP_EOL; - - $table = $metadata->getTable($tableName); - - echo ' With columns: ' . PHP_EOL; - foreach ($table->getColumns() as $column) { - echo ' ' . $column->getName() - . ' -> ' . $column->getDataType() - . PHP_EOL; - } - - echo PHP_EOL; - echo ' With constraints: ' . PHP_EOL; - - foreach ($metadata->getConstraints($tableName) as $constraint) { - echo ' ' . $constraint->getName() - . ' -> ' . $constraint->getType() - . PHP_EOL; - - if (! $constraint->hasColumns()) { - continue; - } - - echo ' column: ' . implode(', ', $constraint->getColumns()); - if ($constraint->isForeignKey()) { - $fkCols = []; - foreach ($constraint->getReferencedColumns() as $refColumn) { - $fkCols[] = $constraint->getReferencedTableName() . '.' . $refColumn; - } - echo ' => ' . implode(', ', $fkCols); - } - - echo PHP_EOL; - } - - echo '----' . PHP_EOL; -} -``` - -## Metadata value objects - -Metadata returns value objects that provide an interface to help developers -better explore the metadata. Below is the API for the various value objects: - -### TableObject - -```php -class Zend\Db\Metadata\Object\TableObject -{ - public function __construct($name); - public function setColumns(array $columns); - public function getColumns(); - public function setConstraints($constraints); - public function getConstraints(); - public function setName($name); - public function getName(); -} -``` - -### ColumnObject - -```php -class Zend\Db\Metadata\Object\ColumnObject -{ - public function __construct($name, $tableName, $schemaName = null); - public function setName($name); - public function getName(); - public function getTableName(); - public function setTableName($tableName); - public function setSchemaName($schemaName); - public function getSchemaName(); - public function getOrdinalPosition(); - public function setOrdinalPosition($ordinalPosition); - public function getColumnDefault(); - public function setColumnDefault($columnDefault); - public function getIsNullable(); - public function setIsNullable($isNullable); - public function isNullable(); - public function getDataType(); - public function setDataType($dataType); - public function getCharacterMaximumLength(); - public function setCharacterMaximumLength($characterMaximumLength); - public function getCharacterOctetLength(); - public function setCharacterOctetLength($characterOctetLength); - public function getNumericPrecision(); - public function setNumericPrecision($numericPrecision); - public function getNumericScale(); - public function setNumericScale($numericScale); - public function getNumericUnsigned(); - public function setNumericUnsigned($numericUnsigned); - public function isNumericUnsigned(); - public function getErratas(); - public function setErratas(array $erratas); - public function getErrata($errataName); - public function setErrata($errataName, $errataValue); -} -``` - -### ConstraintObject - -```php -class Zend\Db\Metadata\Object\ConstraintObject -{ - public function __construct($name, $tableName, $schemaName = null); - public function setName($name); - public function getName(); - public function setSchemaName($schemaName); - public function getSchemaName(); - public function getTableName(); - public function setTableName($tableName); - public function setType($type); - public function getType(); - public function hasColumns(); - public function getColumns(); - public function setColumns(array $columns); - public function getReferencedTableSchema(); - public function setReferencedTableSchema($referencedTableSchema); - public function getReferencedTableName(); - public function setReferencedTableName($referencedTableName); - public function getReferencedColumns(); - public function setReferencedColumns(array $referencedColumns); - public function getMatchOption(); - public function setMatchOption($matchOption); - public function getUpdateRule(); - public function setUpdateRule($updateRule); - public function getDeleteRule(); - public function setDeleteRule($deleteRule); - public function getCheckClause(); - public function setCheckClause($checkClause); - public function isPrimaryKey(); - public function isUnique(); - public function isForeignKey(); - public function isCheck(); - -} -``` - -### TriggerObject - -```php -class Zend\Db\Metadata\Object\TriggerObject -{ - public function getName(); - public function setName($name); - public function getEventManipulation(); - public function setEventManipulation($eventManipulation); - public function getEventObjectCatalog(); - public function setEventObjectCatalog($eventObjectCatalog); - public function getEventObjectSchema(); - public function setEventObjectSchema($eventObjectSchema); - public function getEventObjectTable(); - public function setEventObjectTable($eventObjectTable); - public function getActionOrder(); - public function setActionOrder($actionOrder); - public function getActionCondition(); - public function setActionCondition($actionCondition); - public function getActionStatement(); - public function setActionStatement($actionStatement); - public function getActionOrientation(); - public function setActionOrientation($actionOrientation); - public function getActionTiming(); - public function setActionTiming($actionTiming); - public function getActionReferenceOldTable(); - public function setActionReferenceOldTable($actionReferenceOldTable); - public function getActionReferenceNewTable(); - public function setActionReferenceNewTable($actionReferenceNewTable); - public function getActionReferenceOldRow(); - public function setActionReferenceOldRow($actionReferenceOldRow); - public function getActionReferenceNewRow(); - public function setActionReferenceNewRow($actionReferenceNewRow); - public function getCreated(); - public function setCreated($created); -} -``` diff --git a/bundled-libs/zendframework/zend-db/docs/book/result-set.md b/bundled-libs/zendframework/zend-db/docs/book/result-set.md deleted file mode 100644 index 9e6b5aaa..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/result-set.md +++ /dev/null @@ -1,157 +0,0 @@ -# Result Sets - -`Zend\Db\ResultSet` is a sub-component of zend-db for abstracting the iteration -of results returned from queries producing rowsets. While data sources for this -can be anything that is iterable, generally these will be populated from -`Zend\Db\Adapter\Driver\ResultInterface` instances. - -Result sets must implement the `Zend\Db\ResultSet\ResultSetInterface`, and all -sub-components of zend-db that return a result set as part of their API will -assume an instance of a `ResultSetInterface` should be returned. In most cases, -the prototype pattern will be used by consuming object to clone a prototype of -a `ResultSet` and return a specialized `ResultSet` with a specific data source -injected. `ResultSetInterface` is defined as follows: - -```php -use Countable; -use Traversable; - -interface ResultSetInterface extends Traversable, Countable -{ - public function initialize(mixed $dataSource) : void; - public function getFieldCount() : int; -} -``` - -## Quick start - -`Zend\Db\ResultSet\ResultSet` is the most basic form of a `ResultSet` object -that will expose each row as either an `ArrayObject`-like object or an array of -row data. By default, `Zend\Db\Adapter\Adapter` will use a prototypical -`Zend\Db\ResultSet\ResultSet` object for iterating when using the -`Zend\Db\Adapter\Adapter::query()` method. - -The following is an example workflow similar to what one might find inside -`Zend\Db\Adapter\Adapter::query()`: - -```php -use Zend\Db\Adapter\Driver\ResultInterface; -use Zend\Db\ResultSet\ResultSet; - -$statement = $driver->createStatement('SELECT * FROM users'); -$statement->prepare(); -$result = $statement->execute($parameters); - -if ($result instanceof ResultInterface && $result->isQueryResult()) { - $resultSet = new ResultSet; - $resultSet->initialize($result); - - foreach ($resultSet as $row) { - echo $row->my_column . PHP_EOL; - } -} -``` - -## Zend\\Db\\ResultSet\\ResultSet and Zend\\Db\\ResultSet\\AbstractResultSet - -For most purposes, either an instance of `Zend\Db\ResultSet\ResultSet` or a -derivative of `Zend\Db\ResultSet\AbstractResultSet` will be used. The -implementation of the `AbstractResultSet` offers the following core -functionality: - -```php -namespace Zend\Db\ResultSet; - -use Iterator; - -abstract class AbstractResultSet implements Iterator, ResultSetInterface -{ - public function initialize(array|Iterator|IteratorAggregate|ResultInterface $dataSource) : self; - public function getDataSource() : Iterator|IteratorAggregate|ResultInterface; - public function getFieldCount() : int; - - /** Iterator */ - public function next() : mixed; - public function key() : string|int; - public function current() : mixed; - public function valid() : bool; - public function rewind() : void; - - /** countable */ - public function count() : int; - - /** get rows as array */ - public function toArray() : array; -} -``` - -## Zend\\Db\\ResultSet\\HydratingResultSet - -`Zend\Db\ResultSet\HydratingResultSet` is a more flexible `ResultSet` object -that allows the developer to choose an appropriate "hydration strategy" for -getting row data into a target object. While iterating over results, -`HydratingResultSet` will take a prototype of a target object and clone it once -for each row. The `HydratingResultSet` will then hydrate that clone with the -row data. - -The `HydratingResultSet` depends on -[zend-hydrator](https://docs.zendframework.com/zend-hydrator), which you will -need to install: - -```bash -$ composer require zendframework/zend-hydrator -``` - -In the example below, rows from the database will be iterated, and during -iteration, `HydratingResultSet` will use the `Reflection` based hydrator to -inject the row data directly into the protected members of the cloned -`UserEntity` object: - -```php -use Zend\Db\Adapter\Driver\ResultInterface; -use Zend\Db\ResultSet\HydratingResultSet; -use Zend\Hydrator\Reflection as ReflectionHydrator; - -class UserEntity -{ - protected $first_name; - protected $last_name; - - public function getFirstName() - { - return $this->first_name; - } - - public function getLastName() - { - return $this->last_name; - } - - public function setFirstName($firstName) - { - $this->first_name = $firstName; - } - - public function setLastName($lastName) - { - $this->last_name = $lastName; - } -} - -$statement = $driver->createStatement($sql); -$statement->prepare($parameters); -$result = $statement->execute(); - -if ($result instanceof ResultInterface && $result->isQueryResult()) { - $resultSet = new HydratingResultSet(new ReflectionHydrator, new UserEntity); - $resultSet->initialize($result); - - foreach ($resultSet as $user) { - echo $user->getFirstName() . ' ' . $user->getLastName() . PHP_EOL; - } -} -``` - -For more information, see the [zend-hydrator](https://docs.zendframework.com/zend-hydrator/) -documentation to get a better sense of the different strategies that can be -employed in order to populate a target object. diff --git a/bundled-libs/zendframework/zend-db/docs/book/row-gateway.md b/bundled-libs/zendframework/zend-db/docs/book/row-gateway.md deleted file mode 100644 index 4b986003..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/row-gateway.md +++ /dev/null @@ -1,98 +0,0 @@ -# Row Gateways - -`Zend\Db\RowGateway` is a sub-component of zend-db that implements the Row Data -Gateway pattern described in the book [Patterns of Enterprise Application -Architecture](http://www.martinfowler.com/books/eaa.html). Row Data Gateways -model individual rows of a database table, and provide methods such as `save()` -and `delete()` that persist the row to the database. Likewise, after a row from -the database is retrieved, it can then be manipulated and `save()`'d back to -the database in the same position (row), or it can be `delete()`'d from the -table. - -`RowGatewayInterface` defines the methods `save()` and `delete()`: - -```php -namespace Zend\Db\RowGateway; - -interface RowGatewayInterface -{ - public function save(); - public function delete(); -} -``` - -## Quick start - -`RowGateway` is generally used in conjunction with objects that produce -`Zend\Db\ResultSet`s, though it may also be used standalone. To use it -standalone, you need an `Adapter` instance and a set of data to work with. - -The following demonstrates a basic use case. - -```php -use Zend\Db\RowGateway\RowGateway; - -// Query the database: -$resultSet = $adapter->query('SELECT * FROM `user` WHERE `id` = ?', [2]); - -// Get array of data: -$rowData = $resultSet->current()->getArrayCopy(); - -// Create a row gateway: -$rowGateway = new RowGateway('id', 'my_table', $adapter); -$rowGateway->populate($rowData, true); - -// Manipulate the row and persist it: -$rowGateway->first_name = 'New Name'; -$rowGateway->save(); - -// Or delete this row: -$rowGateway->delete(); -``` - -The workflow described above is greatly simplified when `RowGateway` is used in -conjunction with the [TableGateway RowGatewayFeature](table-gateway.md#tablegateway-features). -In that paradigm, `select()` operations will produce a `ResultSet` that iterates -`RowGateway` instances. - -As an example: - -```php -use Zend\Db\TableGateway\Feature\RowGatewayFeature; -use Zend\Db\TableGateway\TableGateway; - -$table = new TableGateway('artist', $adapter, new RowGatewayFeature('id')); -$results = $table->select(['id' => 2]); - -$artistRow = $results->current(); -$artistRow->name = 'New Name'; -$artistRow->save(); -``` - -## ActiveRecord Style Objects - -If you wish to have custom behaviour in your `RowGateway` objects — -essentially making them behave similarly to the -[ActiveRecord](http://www.martinfowler.com/eaaCatalog/activeRecord.html) -pattern), pass a prototype object implementing the `RowGatewayInterface` to the -`RowGatewayFeature` constructor instead of a primary key: - -```php -use Zend\Db\TableGateway\Feature\RowGatewayFeature; -use Zend\Db\TableGateway\TableGateway; -use Zend\Db\RowGateway\RowGatewayInterface; - -class Artist implements RowGatewayInterface -{ - protected $adapter; - - public function __construct($adapter) - { - $this->adapter = $adapter; - } - - // ... save() and delete() implementations -} - -$table = new TableGateway('artist', $adapter, new RowGatewayFeature(new Artist($adapter))); -``` diff --git a/bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md b/bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md deleted file mode 100644 index 0daac436..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/sql-ddl.md +++ /dev/null @@ -1,201 +0,0 @@ -# DDL Abstraction - -`Zend\Db\Sql\Ddl` is a sub-component of `Zend\Db\Sql` allowing creation of DDL -(Data Definition Language) SQL statements. When combined with a platform -specific `Zend\Db\Sql\Sql` object, DDL objects are capable of producing -platform-specific `CREATE TABLE` statements, with specialized data types, -constraints, and indexes for a database/schema. - -The following platforms have platform specializations for DDL: - -- MySQL -- All databases compatible with ANSI SQL92 - -## Creating Tables - -Like `Zend\Db\Sql` objects, each statement type is represented by a class. For -example, `CREATE TABLE` is modeled by the `CreateTable` class; this is likewise -the same for `ALTER TABLE` (as `AlterTable`), and `DROP TABLE` (as -`DropTable`). You can create instances using a number of approaches: - -```php -use Zend\Db\Sql\Ddl; -use Zend\Db\Sql\TableIdentifier; - -$table = new Ddl\CreateTable(); - -// With a table name: -$table = new Ddl\CreateTable('bar'); - -// With a schema name "foo": -$table = new Ddl\CreateTable(new TableIdentifier('bar', 'foo')); - -// Optionally, as a temporary table: -$table = new Ddl\CreateTable('bar', true); -``` - -You can also set the table after instantiation: - -```php -$table->setTable('bar'); -``` - -Currently, columns are added by creating a column object (described in the -[data type table below](#currently-supported-data-types)): - -```php -use Zend\Db\Sql\Ddl\Column; - -$table->addColumn(new Column\Integer('id')); -$table->addColumn(new Column\Varchar('name', 255)); -``` - -Beyond adding columns to a table, you may also add constraints: - -```php -use Zend\Db\Sql\Ddl\Constraint; - -$table->addConstraint(new Constraint\PrimaryKey('id')); -$table->addConstraint( - new Constraint\UniqueKey(['name', 'foo'], 'my_unique_key') -); -``` -You can also use the `AUTO_INCREMENT` attribute for MySQL: -```php -use Zend\Db\Sql\Ddl\Column; - -$column = new Column\Integer('id'); -$column->setOption('AUTO_INCREMENT', true); -``` - -## Altering Tables - -Similar to `CreateTable`, you may also use `AlterTable` instances: - -```php -use Zend\Db\Sql\Ddl; -use Zend\Db\Sql\TableIdentifier; - -$table = new Ddl\AlterTable(); - -// With a table name: -$table = new Ddl\AlterTable('bar'); - -// With a schema name "foo": -$table = new Ddl\AlterTable(new TableIdentifier('bar', 'foo')); - -// Optionally, as a temporary table: -$table = new Ddl\AlterTable('bar', true); -``` - -The primary difference between a `CreateTable` and `AlterTable` is that the -`AlterTable` takes into account that the table and its assets already exist. -Therefore, while you still have `addColumn()` and `addConstraint()`, you will -also have the ability to *alter* existing columns: - -```php -use Zend\Db\Sql\Ddl\Column; - -$table->changeColumn('name', Column\Varchar('new_name', 50)); -``` - -You may also *drop* existing columns or constraints: - -```php -$table->dropColumn('foo'); -$table->dropConstraint('my_index'); -``` - -## Dropping Tables - -To drop a table, create a `DropTable` instance: - -```php -use Zend\Db\Sql\Ddl; -use Zend\Db\Sql\TableIdentifier; - -// With a table name: -$drop = new Ddl\DropTable('bar'); - -// With a schema name "foo": -$drop = new Ddl\DropTable(new TableIdentifier('bar', 'foo')); -``` - -## Executing DDL Statements - -After a DDL statement object has been created and configured, at some point you -will need to execute the statement. This requires an `Adapter` instance and a -properly seeded `Sql` instance. - -The workflow looks something like this, with `$ddl` being a `CreateTable`, -`AlterTable`, or `DropTable` instance: - -```php -use Zend\Db\Sql\Sql; - -// Existence of $adapter is assumed. -$sql = new Sql($adapter); - -$adapter->query( - $sql->getSqlStringForSqlObject($ddl), - $adapter::QUERY_MODE_EXECUTE -); -``` - -By passing the `$ddl` object through the `$sql` instance's -`getSqlStringForSqlObject()` method, we ensure that any platform specific -specializations/modifications are utilized to create a platform specific SQL -statement. - -Next, using the constant `Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE` ensures -that the SQL statement is not prepared, as most DDL statements on most -platforms cannot be prepared, only executed. - -## Currently Supported Data Types - -These types exist in the `Zend\Db\Sql\Ddl\Column` namespace. Data types must -implement `Zend\Db\Sql\Ddl\Column\ColumnInterface`. - -In alphabetical order: - -Type | Arguments For Construction ------------------|--------------------------- -BigInteger | `$name`, `$nullable = false`, `$default = null`, `array $options = array()` -Binary | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()` -Blob | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()` -Boolean | `$name` -Char | `$name`, `length` -Column (generic) | `$name = null` -Date | `$name` -DateTime | `$name` -Decimal | `$name`, `$precision`, `$scale = null` -Float | `$name`, `$digits`, `$decimal` (Note: this class is deprecated as of 2.4.0; use Floating instead) -Floating | `$name`, `$digits`, `$decimal` -Integer | `$name`, `$nullable = false`, `default = null`, `array $options = array()` -Text | `$name`, `$length`, `nullable = false`, `$default = null`, `array $options = array()` -Time | `$name` -Timestamp | `$name` -Varbinary | `$name`, `$length` -Varchar | `$name`, `$length` - -Each of the above types can be utilized in any place that accepts a `Column\ColumnInterface` -instance. Currently, this is primarily in `CreateTable::addColumn()` and `AlterTable`'s -`addColumn()` and `changeColumn()` methods. - -## Currently Supported Constraint Types - -These types exist in the `Zend\Db\Sql\Ddl\Constraint` namespace. Data types -must implement `Zend\Db\Sql\Ddl\Constraint\ConstraintInterface`. - -In alphabetical order: - -Type | Arguments For Construction ------------|--------------------------- -Check | `$expression`, `$name` -ForeignKey | `$name`, `$column`, `$referenceTable`, `$referenceColumn`, `$onDeleteRule = null`, `$onUpdateRule = null` -PrimaryKey | `$columns` -UniqueKey | `$column`, `$name = null` - -Each of the above types can be utilized in any place that accepts a -`Column\ConstraintInterface` instance. Currently, this is primarily in -`CreateTable::addConstraint()` and `AlterTable::addConstraint()`. diff --git a/bundled-libs/zendframework/zend-db/docs/book/sql.md b/bundled-libs/zendframework/zend-db/docs/book/sql.md deleted file mode 100644 index 52f5ab8b..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/sql.md +++ /dev/null @@ -1,741 +0,0 @@ -# SQL Abstraction - -`Zend\Db\Sql` is a SQL abstraction layer for building platform-specific SQL -queries via an object-oriented API. The end result of a `Zend\Db\Sql` object -will be to either produce a `Statement` and `ParameterContainer` that -represents the target query, or a full string that can be directly executed -against the database platform. To achieve this, `Zend\Db\Sql` objects require a -`Zend\Db\Adapter\Adapter` object in order to produce the desired results. - -## Quick start - -There are four primary tasks associated with interacting with a database -defined by Data Manipulation Language (DML): selecting, inserting, updating, -and deleting. As such, there are four primary classes that developers can -interact with in order to build queries in the `Zend\Db\Sql` namespace: -`Select`, `Insert`, `Update`, and `Delete`. - -Since these four tasks are so closely related and generally used together -within the same application, the `Zend\Db\Sql\Sql` class helps you create them -and produce the result you are attempting to achieve. - -```php -use Zend\Db\Sql\Sql; - -$sql = new Sql($adapter); -$select = $sql->select(); // returns a Zend\Db\Sql\Select instance -$insert = $sql->insert(); // returns a Zend\Db\Sql\Insert instance -$update = $sql->update(); // returns a Zend\Db\Sql\Update instance -$delete = $sql->delete(); // returns a Zend\Db\Sql\Delete instance -``` - -As a developer, you can now interact with these objects, as described in the -sections below, to customize each query. Once they have been populated with -values, they are ready to either be prepared or executed. - -To prepare (using a Select object): - -```php -use Zend\Db\Sql\Sql; - -$sql = new Sql($adapter); -$select = $sql->select(); -$select->from('foo'); -$select->where(['id' => 2]); - -$statement = $sql->prepareStatementForSqlObject($select); -$results = $statement->execute(); -``` - -To execute (using a Select object) - -```php -use Zend\Db\Sql\Sql; - -$sql = new Sql($adapter); -$select = $sql->select(); -$select->from('foo'); -$select->where(['id' => 2]); - -$selectString = $sql->buildSqlString($select); -$results = $adapter->query($selectString, $adapter::QUERY_MODE_EXECUTE); -``` - -`Zend\\Db\\Sql\\Sql` objects can also be bound to a particular table so that in -obtaining a `Select`, `Insert`, `Update`, or `Delete` instance, the object will be -seeded with the table: - -```php -use Zend\Db\Sql\Sql; - -$sql = new Sql($adapter, 'foo'); -$select = $sql->select(); -$select->where(['id' => 2]); // $select already has from('foo') applied -``` - -## Common interfaces for SQL implementations - -Each of these objects implements the following two interfaces: - -```php -interface PreparableSqlInterface -{ - public function prepareStatement(Adapter $adapter, StatementInterface $statement) : void; -} - -interface SqlInterface -{ - public function getSqlString(PlatformInterface $adapterPlatform = null) : string; -} -``` - -Use these functions to produce either (a) a prepared statement, or (b) a string -to execute. - -## Select - -`Zend\Db\Sql\Select` presents a unified API for building platform-specific SQL -SELECT queries. Instances may be created and consumed without -`Zend\Db\Sql\Sql`: - -```php -use Zend\Db\Sql\Select; - -$select = new Select(); -// or, to produce a $select bound to a specific table -$select = new Select('foo'); -``` - -If a table is provided to the `Select` object, then `from()` cannot be called -later to change the name of the table. - -Once you have a valid `Select` object, the following API can be used to further -specify various select statement parts: - -```php -class Select extends AbstractSql implements SqlInterface, PreparableSqlInterface -{ - const JOIN_INNER = 'inner'; - const JOIN_OUTER = 'outer'; - const JOIN_LEFT = 'left'; - const JOIN_RIGHT = 'right'; - const SQL_STAR = '*'; - const ORDER_ASCENDING = 'ASC'; - const ORDER_DESCENDING = 'DESC'; - - public $where; // @param Where $where - - public function __construct(string|array|TableIdentifier $table = null); - public function from(string|array|TableIdentifier $table) : self; - public function columns(array $columns, bool $prefixColumnsWithTable = true) : self; - public function join(string|array $name, string $on, string|array $columns = self::SQL_STAR, string $type = self::JOIN_INNER) : self; - public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self; - public function group(string|array $group); - public function having(Having|callable|string|array $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self; - public function order(string|array $order) : self; - public function limit(int $limit) : self; - public function offset(int $offset) : self; -} -``` - -### from() - -```php -// As a string: -$select->from('foo'); - -// As an array to specify an alias -// (produces SELECT "t".* FROM "table" AS "t") -$select->from(['t' => 'table']); - -// Using a Sql\TableIdentifier: -// (same output as above) -$select->from(['t' => new TableIdentifier('table')]); -``` - -### columns() - -```php -// As an array of names -$select->columns(['foo', 'bar']); - -// As an associative array with aliases as the keys -// (produces 'bar' AS 'foo', 'bax' AS 'baz') -$select->columns([ - 'foo' => 'bar', - 'baz' => 'bax' -]); - -// Sql function call on the column -// (produces CONCAT_WS('/', 'bar', 'bax') AS 'foo') -$select->columns([ - 'foo' => new \Zend\Db\Sql\Expression("CONCAT_WS('/', 'bar', 'bax')") -]); -``` - -### join() - -```php -$select->join( - 'foo', // table name - 'id = bar.id', // expression to join on (will be quoted by platform object before insertion), - ['bar', 'baz'], // (optional) list of columns, same requirements as columns() above - $select::JOIN_OUTER // (optional), one of inner, outer, left, right also represented by constants in the API -); - -$select - ->from(['f' => 'foo']) // base table - ->join( - ['b' => 'bar'], // join table with alias - 'f.foo_id = b.foo_id' // join expression - ); -``` - -### where(), having() - -`Zend\Db\Sql\Select` provides bit of flexibility as it regards to what kind of -parameters are acceptable when calling `where()` or `having()`. The method -signature is listed as: - -```php -/** - * Create where clause - * - * @param Where|callable|string|array $predicate - * @param string $combination One of the OP_* constants from Predicate\PredicateSet - * @return Select - */ -public function where($predicate, $combination = Predicate\PredicateSet::OP_AND); -``` - -If you provide a `Zend\Db\Sql\Where` instance to `where()` or a -`Zend\Db\Sql\Having` instance to `having()`, any previous internal instances -will be replaced completely. When either instance is processed, this object will -be iterated to produce the WHERE or HAVING section of the SELECT statement. - -If you provide a PHP callable to `where()` or `having()`, this function will be -called with the `Select`'s `Where`/`Having` instance as the only parameter. -This enables code like the following: - -```php -$select->where(function (Where $where) { - $where->like('username', 'ralph%'); -}); -``` - -If you provide a *string*, this string will be used to create a -`Zend\Db\Sql\Predicate\Expression` instance, and its contents will be applied -as-is, with no quoting: - -```php -// SELECT "foo".* FROM "foo" WHERE x = 5 -$select->from('foo')->where('x = 5'); -``` - -If you provide an array with integer indices, the value can be one of: - -- a string; this will be used to build a `Predicate\Expression`. -- any object implementing `Predicate\PredicateInterface`. - -In either case, the instances are pushed onto the `Where` stack with the -`$combination` provided (defaulting to `AND`). - -As an example: - -```php -// SELECT "foo".* FROM "foo" WHERE x = 5 AND y = z -$select->from('foo')->where(['x = 5', 'y = z']); -``` - -If you provide an associative array with string keys, any value with a string -key will be cast as follows: - -PHP value | Predicate type ---------- | -------------- -`null` | `Predicate\IsNull` -`array` | `Predicate\In` -`string` | `Predicate\Operator`, where the key is the identifier. - -As an example: - -```php -// SELECT "foo".* FROM "foo" WHERE "c1" IS NULL AND "c2" IN (?, ?, ?) AND "c3" IS NOT NULL -$select->from('foo')->where([ - 'c1' => null, - 'c2' => [1, 2, 3], - new \Zend\Db\Sql\Predicate\IsNotNull('c3'), -]); -``` - -As another example of complex queries with nested conditions e.g. - -```sql -SELECT * WHERE (column1 is null or column1 = 2) AND (column2 = 3) -``` - -you need to use the `nest()` and `unnest()` methods, as follows: - -```php -$select->where->nest() // bracket opened - ->isNull('column1') - ->or - ->equalTo('column1', '2') - ->unnest(); // bracket closed - ->equalTo('column2', '3'); -``` - -### order() - -```php -$select = new Select; -$select->order('id DESC'); // produces 'id' DESC - -$select = new Select; -$select - ->order('id DESC') - ->order('name ASC, age DESC'); // produces 'id' DESC, 'name' ASC, 'age' DESC - -$select = new Select; -$select->order(['name ASC', 'age DESC']); // produces 'name' ASC, 'age' DESC -``` - -### limit() and offset() - -```php -$select = new Select; -$select->limit(5); // always takes an integer/numeric -$select->offset(10); // similarly takes an integer/numeric -``` - -## Insert - -The Insert API: - -```php -class Insert implements SqlInterface, PreparableSqlInterface -{ - const VALUES_MERGE = 'merge'; - const VALUES_SET = 'set'; - - public function __construct(string|TableIdentifier $table = null); - public function into(string|TableIdentifier $table) : self; - public function columns(array $columns) : self; - public function values(array $values, string $flag = self::VALUES_SET) : self; -} -``` - -As with `Select`, the table may be provided during instantiation or via the -`into()` method. - -### columns() - -```php -$insert->columns(['foo', 'bar']); // set the valid columns -``` - -### values() - -```php -// The default behavior of values is to set the values; -// successive calls will not preserve values from previous calls. -$insert->values([ - 'col_1' => 'value1', - 'col_2' => 'value2', -]); -``` - -```php -// To merge values with previous calls, provide the appropriate flag: -$insert->values(['col_2' => 'value2'], $insert::VALUES_MERGE); -``` - -## Update - -```php -class Update -{ - const VALUES_MERGE = 'merge'; - const VALUES_SET = 'set'; - - public $where; // @param Where $where - public function __construct(string|TableIdentifier $table = null); - public function table(string|TableIdentifier $table) : self; - public function set(array $values, string $flag = self::VALUES_SET) : self; - public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self; -} -``` - -### set() - -```php -$update->set(['foo' => 'bar', 'baz' => 'bax']); -``` - -### where() - -See the [section on Where and Having](#where-and-having). - -## Delete - -```php -class Delete -{ - public $where; // @param Where $where - - public function __construct(string|TableIdentifier $table = null); - public function from(string|TableIdentifier $table); - public function where(Where|callable|string|array|PredicateInterface $predicate, string $combination = Predicate\PredicateSet::OP_AND) : self; -} -``` - -### where() - -See the [section on Where and Having](#where-and-having). - -## Where and Having - -In the following, we will talk about `Where`; note, however, that `Having` -utilizes the same API. - -Effectively, `Where` and `Having` extend from the same base object, a -`Predicate` (and `PredicateSet`). All of the parts that make up a WHERE or -HAVING clause that are AND'ed or OR'd together are called *predicates*. The -full set of predicates is called a `PredicateSet`. A `Predicate` generally -contains the values (and identifiers) separate from the fragment they belong to -until the last possible moment when the statement is either prepared -(parameteritized) or executed. In parameterization, the parameters will be -replaced with their proper placeholder (a named or positional parameter), and -the values stored inside an `Adapter\ParameterContainer`. When executed, the -values will be interpolated into the fragments they belong to and properly -quoted. - -In the `Where`/`Having` API, a distinction is made between what elements are -considered identifiers (`TYPE_IDENTIFIER`) and which are values (`TYPE_VALUE`). -There is also a special use case type for literal values (`TYPE_LITERAL`). All -element types are expressed via the `Zend\Db\Sql\ExpressionInterface` -interface. - -> ### Literals -> -> In ZF 2.1, an actual `Literal` type was added. `Zend\Db\Sql` now makes the -> distinction that literals will not have any parameters that need -> interpolating, while `Expression` objects *might* have parameters that need -> interpolating. In cases where there are parameters in an `Expression`, -> `Zend\Db\Sql\AbstractSql` will do its best to identify placeholders when the -> `Expression` is processed during statement creation. In short, if you don't -> have parameters, use `Literal` objects. - -The `Where` and `Having` API is that of `Predicate` and `PredicateSet`: - -```php -// Where & Having extend Predicate: -class Predicate extends PredicateSet -{ - public $and; - public $or; - public $AND; - public $OR; - public $NEST; - public $UNNEST; - - public function nest() : Predicate; - public function setUnnest(Predicate $predicate) : void; - public function unnest() : Predicate; - public function equalTo( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function notEqualTo( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function lessThan( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function greaterThan( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function lessThanOrEqualTo( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function greaterThanOrEqualTo( - int|float|bool|string $left, - int|float|bool|string $right, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ) : self; - public function like(string $identifier, string $like) : self; - public function notLike(string $identifier, string $notLike) : self; - public function literal(string $literal) : self; - public function expression(string $expression, array $parameters = null) : self; - public function isNull(string $identifier) : self; - public function isNotNull(string $identifier) : self; - public function in(string $identifier, array $valueSet = []) : self; - public function notIn(string $identifier, array $valueSet = []) : self; - public function between( - string $identifier, - int|float|string $minValue, - int|float|string $maxValue - ) : self; - public function notBetween( - string $identifier, - int|float|string $minValue, - int|float|string $maxValue - ) : self; - public function predicate(PredicateInterface $predicate) : self; - - // Inherited From PredicateSet - - public function addPredicate(PredicateInterface $predicate, $combination = null) : self; - public function getPredicates() PredicateInterface[]; - public function orPredicate(PredicateInterface $predicate) : self; - public function andPredicate(PredicateInterface $predicate) : self; - public function getExpressionData() : array; - public function count() : int; -} -``` - -Each method in the API will produce a corresponding `Predicate` object of a similarly named -type, as described below. - -### equalTo(), lessThan(), greaterThan(), lessThanOrEqualTo(), greaterThanOrEqualTo() - -```php -$where->equalTo('id', 5); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\Operator($left, Operator::OPERATOR_EQUAL_TO, $right, $leftType, $rightType) -); -``` - -Operators use the following API: - -```php -class Operator implements PredicateInterface -{ - const OPERATOR_EQUAL_TO = '='; - const OP_EQ = '='; - const OPERATOR_NOT_EQUAL_TO = '!='; - const OP_NE = '!='; - const OPERATOR_LESS_THAN = '<'; - const OP_LT = '<'; - const OPERATOR_LESS_THAN_OR_EQUAL_TO = '<='; - const OP_LTE = '<='; - const OPERATOR_GREATER_THAN = '>'; - const OP_GT = '>'; - const OPERATOR_GREATER_THAN_OR_EQUAL_TO = '>='; - const OP_GTE = '>='; - - public function __construct( - int|float|bool|string $left = null, - string $operator = self::OPERATOR_EQUAL_TO, - int|float|bool|string $right = null, - string $leftType = self::TYPE_IDENTIFIER, - string $rightType = self::TYPE_VALUE - ); - public function setLeft(int|float|bool|string $left); - public function getLeft() : int|float|bool|string; - public function setLeftType(string $type) : self; - public function getLeftType() : string; - public function setOperator(string $operator); - public function getOperator() : string; - public function setRight(int|float|bool|string $value) : self; - public function getRight() : int|float|bool|string; - public function setRightType(string $type) : self; - public function getRightType() : string; - public function getExpressionData() : array; -} -``` - -### like($identifier, $like), notLike($identifier, $notLike) - -```php -$where->like($identifier, $like): - -// The above is equivalent to: -$where->addPredicate( - new Predicate\Like($identifier, $like) -); -``` - -The following is the `Like` API: - -```php -class Like implements PredicateInterface -{ - public function __construct(string $identifier = null, string $like = null); - public function setIdentifier(string $identifier) : self; - public function getIdentifier() : string; - public function setLike(string $like) : self; - public function getLike() : string; -} -``` - -### literal($literal) - -```php -$where->literal($literal); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\Literal($literal) -); -``` - -The following is the `Literal` API: - -```php -class Literal implements ExpressionInterface, PredicateInterface -{ - const PLACEHOLDER = '?'; - public function __construct(string $literal = ''); - public function setLiteral(string $literal) : self; - public function getLiteral() : string; -} -``` - -### expression($expression, $parameter) - -```php -$where->expression($expression, $parameter); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\Expression($expression, $parameter) -); -``` - -The following is the `Expression` API: - -```php -class Expression implements ExpressionInterface, PredicateInterface -{ - const PLACEHOLDER = '?'; - - public function __construct( - string $expression = null, - int|float|bool|string|array $valueParameter = null - /* [, $valueParameter, ... ] */ - ); - public function setExpression(string $expression) : self; - public function getExpression() : string; - public function setParameters(int|float|bool|string|array $parameters) : self; - public function getParameters() : array; -} -``` - -### isNull($identifier) - -```php -$where->isNull($identifier); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\IsNull($identifier) -); -``` - -The following is the `IsNull` API: - -```php -class IsNull implements PredicateInterface -{ - public function __construct(string $identifier = null); - public function setIdentifier(string $identifier) : self; - public function getIdentifier() : string; -} -``` - -### isNotNull($identifier) - -```php -$where->isNotNull($identifier); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\IsNotNull($identifier) -); -``` - -The following is the `IsNotNull` API: - -```php -class IsNotNull implements PredicateInterface -{ - public function __construct(string $identifier = null); - public function setIdentifier(string $identifier) : self; - public function getIdentifier() : string; -} -``` - -### in($identifier, $valueSet), notIn($identifier, $valueSet) - -```php -$where->in($identifier, $valueSet); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\In($identifier, $valueSet) -); -``` - -The following is the `In` API: - -```php -class In implements PredicateInterface -{ - public function __construct( - string|array $identifier = null, - array|Select $valueSet = null - ); - public function setIdentifier(string|array $identifier) : self; - public function getIdentifier() : string|array; - public function setValueSet(array|Select $valueSet) : self; - public function getValueSet() : array|Select; -} -``` - -### between($identifier, $minValue, $maxValue), notBetween($identifier, $minValue, $maxValue) - -```php -$where->between($identifier, $minValue, $maxValue); - -// The above is equivalent to: -$where->addPredicate( - new Predicate\Between($identifier, $minValue, $maxValue) -); -``` - -The following is the `Between` API: - -```php -class Between implements PredicateInterface -{ - public function __construct( - string $identifier = null, - int|float|string $minValue = null, - int|float|string $maxValue = null - ); - public function setIdentifier(string $identifier) : self; - public function getIdentifier() : string; - public function setMinValue(int|float|string $minValue) : self; - public function getMinValue() : int|float|string; - public function setMaxValue(int|float|string $maxValue) : self; - public function getMaxValue() : int|float|string; - public function setSpecification(string $specification); -} -``` diff --git a/bundled-libs/zendframework/zend-db/docs/book/table-gateway.md b/bundled-libs/zendframework/zend-db/docs/book/table-gateway.md deleted file mode 100644 index 8e51138c..00000000 --- a/bundled-libs/zendframework/zend-db/docs/book/table-gateway.md +++ /dev/null @@ -1,217 +0,0 @@ -# Table Gateways - -The Table Gateway subcomponent provides an object-oriented representation of a -database table; its methods mirror the most common table operations. In code, -the interface resembles: - -```php -namespace Zend\Db\TableGateway; - -use Zend\Db\ResultSet\ResultSetInterface; -use Zend\Db\Sql\Where; - -interface TableGatewayInterface -{ - public function getTable() : string; - public function select(Where|callable|string|array $where = null) : ResultSetInterface; - public function insert(array $set) : int; - public function update( - array $set, - Where|callable|string|array $where = null, - array $joins = null - ) : int; - public function delete(Where|callable|string|array $where) : int; -} -``` - -There are two primary implementations of the `TableGatewayInterface`, -`AbstractTableGateway` and `TableGateway`. The `AbstractTableGateway` is an -abstract basic implementation that provides functionality for `select()`, -`insert()`, `update()`, `delete()`, as well as an additional API for doing -these same kinds of tasks with explicit `Zend\Db\Sql` objects: `selectWith()`, -`insertWith()`, `updateWith()`, and `deleteWith()`. In addition, -AbstractTableGateway also implements a "Feature" API, that allows for expanding -the behaviors of the base `TableGateway` implementation without having to -extend the class with this new functionality. The `TableGateway` concrete -implementation simply adds a sensible constructor to the `AbstractTableGateway` -class so that out-of-the-box, `TableGateway` does not need to be extended in -order to be consumed and utilized to its fullest. - -## Quick start - -The following example uses `Zend\Db\TableGateway\TableGateway`, which defines -the following API: - -```php -namespace Zend\Db\TableGateway; - -use Zend\Db\Adapter\AdapterInterface; -use Zend\Db\ResultSet\ResultSet; -use Zend\Db\ResultSet\ResultSetInterface; -use Zend\Db\Sql; -use Zend\Db\Sql\TableIdentifier; - -class TableGateway extends AbstractTableGateway -{ - public $lastInsertValue; - public $table; - public $adapter; - - public function __construct( - string|TableIdentifier $table, - AdapterInterface $adapter, - Feature\AbstractFeature|Feature\FeatureSet|Feature\AbstractFeature[] $features = null, - ResultSetInterface $resultSetPrototype = null, - Sql\Sql $sql = null - ); - - /** Inherited from AbstractTableGateway */ - - public function isInitialized() : bool; - public function initialize() : void; - public function getTable() : string; - public function getAdapter() : AdapterInterface; - public function getColumns() : array; - public function getFeatureSet() Feature\FeatureSet; - public function getResultSetPrototype() : ResultSetInterface; - public function getSql() | Sql\Sql; - public function select(Sql\Where|callable|string|array $where = null) : ResultSetInterface; - public function selectWith(Sql\Select $select) : ResultSetInterface; - public function insert(array $set) : int; - public function insertWith(Sql\Insert $insert) | int; - public function update( - array $set, - Sql\Where|callable|string|array $where = null, - array $joins = null - ) : int; - public function updateWith(Sql\Update $update) : int; - public function delete(Sql\Where|callable|string|array $where) : int; - public function deleteWith(Sql\Delete $delete) : int; - public function getLastInsertValue() : int; -} -``` - -The concrete `TableGateway` object uses constructor injection for getting -dependencies and options into the instance. The table name and an instance of -an `Adapter` are all that is required to create an instance. - -Out of the box, this implementation makes no assumptions about table structure -or metadata, and when `select()` is executed, a simple `ResultSet` object with -the populated `Adapter`'s `Result` (the datasource) will be returned and ready -for iteration. - -```php -use Zend\Db\TableGateway\TableGateway; - -$projectTable = new TableGateway('project', $adapter); -$rowset = $projectTable->select(['type' => 'PHP']); - -echo 'Projects of type PHP: ' . PHP_EOL; -foreach ($rowset as $projectRow) { - echo $projectRow['name'] . PHP_EOL; -} - -// Or, when expecting a single row: -$artistTable = new TableGateway('artist', $adapter); -$rowset = $artistTable->select(['id' => 2]); -$artistRow = $rowset->current(); - -var_dump($artistRow); -``` - -The `select()` method takes the same arguments as -`Zend\Db\Sql\Select::where()`; arguments will be passed to the `Select` -instance used to build the SELECT query. This means the following is possible: - -```php -use Zend\Db\TableGateway\TableGateway; -use Zend\Db\Sql\Select; - -$artistTable = new TableGateway('artist', $adapter); - -// Search for at most 2 artists who's name starts with Brit, ascending: -$rowset = $artistTable->select(function (Select $select) { - $select->where->like('name', 'Brit%'); - $select->order('name ASC')->limit(2); -}); -``` - -## TableGateway Features - -The Features API allows for extending the functionality of the base -`TableGateway` object without having to polymorphically extend the base class. -This allows for a wider array of possible mixing and matching of features to -achieve a particular behavior that needs to be attained to make the base -implementation of `TableGateway` useful for a particular problem. - -With the `TableGateway` object, features should be injected through the -constructor. The constructor can take features in 3 different forms: - -- as a single `Feature` instance -- as a `FeatureSet` instance -- as an array of `Feature` instances - -There are a number of features built-in and shipped with zend-db: - -- `GlobalAdapterFeature`: the ability to use a global/static adapter without - needing to inject it into a `TableGateway` instance. This is only useful when - you are extending the `AbstractTableGateway` implementation: - - ```php - use Zend\Db\TableGateway\AbstractTableGateway; - use Zend\Db\TableGateway\Feature; - - class MyTableGateway extends AbstractTableGateway - { - public function __construct() - { - $this->table = 'my_table'; - $this->featureSet = new Feature\FeatureSet(); - $this->featureSet->addFeature(new Feature\GlobalAdapterFeature()); - $this->initialize(); - } - } - - // elsewhere in code, in a bootstrap - Zend\Db\TableGateway\Feature\GlobalAdapterFeature::setStaticAdapter($adapter); - - // in a controller, or model somewhere - $table = new MyTableGateway(); // adapter is statically loaded - ``` - -- `MasterSlaveFeature`: the ability to use a master adapter for `insert()`, - `update()`, and `delete()`, but switch to a slave adapter for all `select()` - operations. - - ```php - $table = new TableGateway('artist', $adapter, new Feature\MasterSlaveFeature($slaveAdapter)); - ``` - -- `MetadataFeature`: the ability populate `TableGateway` with column - information from a `Metadata` object. It will also store the primary key - information in case the `RowGatewayFeature` needs to consume this information. - - ```php - $table = new TableGateway('artist', $adapter, new Feature\MetadataFeature()); - ``` - -- `EventFeature`: the ability to compose a - [zend-eventmanager](https://github.com/zendframework/zend-eventmanager) - `EventManager` instance within your `TableGateway` instance, and attach - listeners to the various events of its lifecycle. - - ```php - $table = new TableGateway('artist', $adapter, new Feature\EventFeature($eventManagerInstance)); - ``` - -- `RowGatewayFeature`: the ability for `select()` to return a `ResultSet` object that upon iteration - will return a `RowGateway` instance for each row. - - ```php - $table = new TableGateway('artist', $adapter, new Feature\RowGatewayFeature('id')); - $results = $table->select(['id' => 2]); - - $artistRow = $results->current(); - $artistRow->name = 'New Name'; - $artistRow->save(); - ``` diff --git a/bundled-libs/zendframework/zend-db/phpcs.xml b/bundled-libs/zendframework/zend-db/phpcs.xml deleted file mode 100644 index e55dab38..00000000 --- a/bundled-libs/zendframework/zend-db/phpcs.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - */test/unit/Adapter/Driver/IbmDb2/StatementTest.php - - - - src - test - diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Adapter.php b/bundled-libs/zendframework/zend-db/src/Adapter/Adapter.php deleted file mode 100644 index e356ff9a..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Adapter.php +++ /dev/null @@ -1,436 +0,0 @@ -createProfiler($parameters); - } - $driver = $this->createDriver($parameters); - } elseif (! $driver instanceof Driver\DriverInterface) { - throw new Exception\InvalidArgumentException( - 'The supplied or instantiated driver object does not implement Zend\Db\Adapter\Driver\DriverInterface' - ); - } - - $driver->checkEnvironment(); - $this->driver = $driver; - - if ($platform === null) { - $platform = $this->createPlatform($parameters); - } - - $this->platform = $platform; - $this->queryResultSetPrototype = ($queryResultPrototype) ?: new ResultSet\ResultSet(); - - if ($profiler) { - $this->setProfiler($profiler); - } - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->driver instanceof Profiler\ProfilerAwareInterface) { - $this->driver->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * getDriver() - * - * @throws Exception\RuntimeException - * @return Driver\DriverInterface - */ - public function getDriver() - { - if ($this->driver === null) { - throw new Exception\RuntimeException('Driver has not been set or configured for this adapter.'); - } - return $this->driver; - } - - /** - * @return Platform\PlatformInterface - */ - public function getPlatform() - { - return $this->platform; - } - - /** - * @return ResultSet\ResultSetInterface - */ - public function getQueryResultSetPrototype() - { - return $this->queryResultSetPrototype; - } - - public function getCurrentSchema() - { - return $this->driver->getConnection()->getCurrentSchema(); - } - - /** - * query() is a convenience function - * - * @param string $sql - * @param string|array|ParameterContainer $parametersOrQueryMode - * @param \Zend\Db\ResultSet\ResultSetInterface $resultPrototype - * @throws Exception\InvalidArgumentException - * @return Driver\StatementInterface|ResultSet\ResultSet - */ - public function query( - $sql, - $parametersOrQueryMode = self::QUERY_MODE_PREPARE, - ResultSet\ResultSetInterface $resultPrototype = null - ) { - if (is_string($parametersOrQueryMode) - && in_array($parametersOrQueryMode, [self::QUERY_MODE_PREPARE, self::QUERY_MODE_EXECUTE]) - ) { - $mode = $parametersOrQueryMode; - $parameters = null; - } elseif (is_array($parametersOrQueryMode) || $parametersOrQueryMode instanceof ParameterContainer) { - $mode = self::QUERY_MODE_PREPARE; - $parameters = $parametersOrQueryMode; - } else { - throw new Exception\InvalidArgumentException( - 'Parameter 2 to this method must be a flag, an array, or ParameterContainer' - ); - } - - if ($mode == self::QUERY_MODE_PREPARE) { - $this->lastPreparedStatement = null; - $this->lastPreparedStatement = $this->driver->createStatement($sql); - $this->lastPreparedStatement->prepare(); - if (is_array($parameters) || $parameters instanceof ParameterContainer) { - if (is_array($parameters)) { - $this->lastPreparedStatement->setParameterContainer(new ParameterContainer($parameters)); - } else { - $this->lastPreparedStatement->setParameterContainer($parameters); - } - $result = $this->lastPreparedStatement->execute(); - } else { - return $this->lastPreparedStatement; - } - } else { - $result = $this->driver->getConnection()->execute($sql); - } - - if ($result instanceof Driver\ResultInterface && $result->isQueryResult()) { - $resultSet = clone ($resultPrototype ?: $this->queryResultSetPrototype); - $resultSet->initialize($result); - return $resultSet; - } - - return $result; - } - - /** - * Create statement - * - * @param string $initialSql - * @param ParameterContainer $initialParameters - * @return Driver\StatementInterface - */ - public function createStatement($initialSql = null, $initialParameters = null) - { - $statement = $this->driver->createStatement($initialSql); - if ($initialParameters === null - || ! $initialParameters instanceof ParameterContainer - && is_array($initialParameters) - ) { - $initialParameters = new ParameterContainer((is_array($initialParameters) ? $initialParameters : [])); - } - $statement->setParameterContainer($initialParameters); - return $statement; - } - - public function getHelpers() - { - $functions = []; - $platform = $this->platform; - foreach (func_get_args() as $arg) { - switch ($arg) { - case self::FUNCTION_QUOTE_IDENTIFIER: - $functions[] = function ($value) use ($platform) { - return $platform->quoteIdentifier($value); - }; - break; - case self::FUNCTION_QUOTE_VALUE: - $functions[] = function ($value) use ($platform) { - return $platform->quoteValue($value); - }; - break; - } - } - } - - /** - * @param $name - * @throws Exception\InvalidArgumentException - * @return Driver\DriverInterface|Platform\PlatformInterface - */ - public function __get($name) - { - switch (strtolower($name)) { - case 'driver': - return $this->driver; - case 'platform': - return $this->platform; - default: - throw new Exception\InvalidArgumentException('Invalid magic property on adapter'); - } - } - - /** - * @param array $parameters - * @return Driver\DriverInterface - * @throws \InvalidArgumentException - * @throws Exception\InvalidArgumentException - */ - protected function createDriver($parameters) - { - if (! isset($parameters['driver'])) { - throw new Exception\InvalidArgumentException( - __FUNCTION__ . ' expects a "driver" key to be present inside the parameters' - ); - } - - if ($parameters['driver'] instanceof Driver\DriverInterface) { - return $parameters['driver']; - } - - if (! is_string($parameters['driver'])) { - throw new Exception\InvalidArgumentException( - __FUNCTION__ . ' expects a "driver" to be a string or instance of DriverInterface' - ); - } - - $options = []; - if (isset($parameters['options'])) { - $options = (array) $parameters['options']; - unset($parameters['options']); - } - - $driverName = strtolower($parameters['driver']); - switch ($driverName) { - case 'mysqli': - $driver = new Driver\Mysqli\Mysqli($parameters, null, null, $options); - break; - case 'sqlsrv': - $driver = new Driver\Sqlsrv\Sqlsrv($parameters); - break; - case 'oci8': - $driver = new Driver\Oci8\Oci8($parameters); - break; - case 'pgsql': - $driver = new Driver\Pgsql\Pgsql($parameters); - break; - case 'ibmdb2': - $driver = new Driver\IbmDb2\IbmDb2($parameters); - break; - case 'pdo': - default: - if ($driverName == 'pdo' || strpos($driverName, 'pdo') === 0) { - $driver = new Driver\Pdo\Pdo($parameters); - } - } - - if (! isset($driver) || ! $driver instanceof Driver\DriverInterface) { - throw new Exception\InvalidArgumentException('DriverInterface expected', null, null); - } - - return $driver; - } - - /** - * @param array $parameters - * @return Platform\PlatformInterface - */ - protected function createPlatform(array $parameters) - { - if (isset($parameters['platform'])) { - $platformName = $parameters['platform']; - } elseif ($this->driver instanceof Driver\DriverInterface) { - $platformName = $this->driver->getDatabasePlatformName(Driver\DriverInterface::NAME_FORMAT_CAMELCASE); - } else { - throw new Exception\InvalidArgumentException( - 'A platform could not be determined from the provided configuration' - ); - } - - // currently only supported by the IbmDb2 & Oracle concrete implementations - $options = (isset($parameters['platform_options'])) ? $parameters['platform_options'] : []; - - switch ($platformName) { - case 'Mysql': - // mysqli or pdo_mysql driver - if ($this->driver instanceof Driver\Mysqli\Mysqli || $this->driver instanceof Driver\Pdo\Pdo) { - $driver = $this->driver; - } else { - $driver = null; - } - return new Platform\Mysql($driver); - case 'SqlServer': - // PDO is only supported driver for quoting values in this platform - return new Platform\SqlServer(($this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null); - case 'Oracle': - if ($this->driver instanceof Driver\Oci8\Oci8 || $this->driver instanceof Driver\Pdo\Pdo) { - $driver = $this->driver; - } else { - $driver = null; - } - return new Platform\Oracle($options, $driver); - case 'Sqlite': - // PDO is only supported driver for quoting values in this platform - if ($this->driver instanceof Driver\Pdo\Pdo) { - return new Platform\Sqlite($this->driver); - } - return new Platform\Sqlite(null); - case 'Postgresql': - // pgsql or pdo postgres driver - if ($this->driver instanceof Driver\Pgsql\Pgsql || $this->driver instanceof Driver\Pdo\Pdo) { - $driver = $this->driver; - } else { - $driver = null; - } - return new Platform\Postgresql($driver); - case 'IbmDb2': - // ibm_db2 driver escaping does not need an action connection - return new Platform\IbmDb2($options); - default: - return new Platform\Sql92(); - } - } - - /** - * - * @param array $parameters - * @return Profiler\ProfilerInterface - * @throws Exception\InvalidArgumentException - */ - protected function createProfiler($parameters) - { - if ($parameters['profiler'] instanceof Profiler\ProfilerInterface) { - $profiler = $parameters['profiler']; - } elseif (is_bool($parameters['profiler'])) { - $profiler = ($parameters['profiler'] == true) ? new Profiler\Profiler : null; - } else { - throw new Exception\InvalidArgumentException( - '"profiler" parameter must be an instance of ProfilerInterface or a boolean' - ); - } - return $profiler; - } - - /** - * @param array $parameters - * @return Driver\DriverInterface - * @throws \InvalidArgumentException - * @throws Exception\InvalidArgumentException - * @deprecated - */ - protected function createDriverFromParameters(array $parameters) - { - return $this->createDriver($parameters); - } - - /** - * @param Driver\DriverInterface $driver - * @return Platform\PlatformInterface - * @deprecated - */ - protected function createPlatformFromDriver(Driver\DriverInterface $driver) - { - return $this->createPlatform($driver); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php b/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php deleted file mode 100644 index 314202fd..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php +++ /dev/null @@ -1,125 +0,0 @@ -getConfig($container); - if (empty($config)) { - return false; - } - - return ( - isset($config[$requestedName]) - && is_array($config[$requestedName]) - && ! empty($config[$requestedName]) - ); - } - - /** - * Determine if we can create a service with name (SM v2 compatibility) - * - * @param ServiceLocatorInterface $serviceLocator - * @param string $name - * @param string $requestedName - * @return bool - */ - public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) - { - return $this->canCreate($serviceLocator, $requestedName); - } - - /** - * Create a DB adapter - * - * @param ContainerInterface $container - * @param string $requestedName - * @param array $options - * @return Adapter - */ - public function __invoke(ContainerInterface $container, $requestedName, array $options = null) - { - $config = $this->getConfig($container); - return new Adapter($config[$requestedName]); - } - - /** - * Create service with name - * - * @param ServiceLocatorInterface $serviceLocator - * @param string $name - * @param string $requestedName - * @return Adapter - */ - public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) - { - return $this($serviceLocator, $requestedName); - } - - /** - * Get db configuration, if any - * - * @param ContainerInterface $container - * @return array - */ - protected function getConfig(ContainerInterface $container) - { - if ($this->config !== null) { - return $this->config; - } - - if (! $container->has('config')) { - $this->config = []; - return $this->config; - } - - $config = $container->get('config'); - if (! isset($config['db']) - || ! is_array($config['db']) - ) { - $this->config = []; - return $this->config; - } - - $config = $config['db']; - if (! isset($config['adapters']) - || ! is_array($config['adapters']) - ) { - $this->config = []; - return $this->config; - } - - $this->config = $config['adapters']; - return $this->config; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php deleted file mode 100644 index 8df8ca62..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -adapter = $adapter; - - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/AdapterInterface.php deleted file mode 100644 index 692ac56e..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/AdapterInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -get('config'); - return new Adapter($config['db']); - } - - /** - * Create db adapter service (v2) - * - * @param ServiceLocatorInterface $container - * @return Adapter - */ - public function createService(ServiceLocatorInterface $container) - { - return $this($container, Adapter::class); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php deleted file mode 100644 index 98f3a89e..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php +++ /dev/null @@ -1,135 +0,0 @@ -isConnected()) { - $this->resource = null; - } - - return $this; - } - - /** - * Get connection parameters - * - * @return array - */ - public function getConnectionParameters() - { - return $this->connectionParameters; - } - - /** - * Get driver name - * - * @return null|string - */ - public function getDriverName() - { - return $this->driverName; - } - - /** - * @return null|ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * {@inheritDoc} - * - * @return resource - */ - public function getResource() - { - if (! $this->isConnected()) { - $this->connect(); - } - - return $this->resource; - } - - /** - * Checks whether the connection is in transaction state. - * - * @return boolean - */ - public function inTransaction() - { - return $this->inTransaction; - } - - /** - * @param array $connectionParameters - * @return self Provides a fluent interface - */ - public function setConnectionParameters(array $connectionParameters) - { - $this->connectionParameters = $connectionParameters; - - return $this; - } - - /** - * {@inheritDoc} - * - * @return self Provides a fluent interface - */ - public function setProfiler(ProfilerInterface $profiler) - { - $this->profiler = $profiler; - - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php deleted file mode 100644 index 847d6773..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php +++ /dev/null @@ -1,85 +0,0 @@ -driver = $driver; - } - - /** - * Get name - * - * @return string - */ - abstract public function getName(); -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php deleted file mode 100644 index 6437c3af..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -setConnectionParameters($connectionParameters); - } elseif (is_resource($connectionParameters)) { - $this->setResource($connectionParameters); - } elseif (null !== $connectionParameters) { - throw new Exception\InvalidArgumentException( - '$connection must be an array of parameters, a db2 connection resource or null' - ); - } - } - - /** - * Set driver - * - * @param IbmDb2 $driver - * @return self Provides a fluent interface - */ - public function setDriver(IbmDb2 $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * @param resource $resource DB2 resource - * @return self Provides a fluent interface - */ - public function setResource($resource) - { - if (! is_resource($resource) || get_resource_type($resource) !== 'DB2 Connection') { - throw new Exception\InvalidArgumentException('The resource provided must be of type "DB2 Connection"'); - } - $this->resource = $resource; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $info = db2_server_info($this->resource); - - return (isset($info->DB_NAME) ? $info->DB_NAME : ''); - } - - /** - * {@inheritDoc} - */ - public function connect() - { - if (is_resource($this->resource)) { - return $this; - } - - // localize - $p = $this->connectionParameters; - - // given a list of key names, test for existence in $p - $findParameterValue = function (array $names) use ($p) { - foreach ($names as $name) { - if (isset($p[$name])) { - return $p[$name]; - } - } - - return; - }; - - $database = $findParameterValue(['database', 'db']); - $username = $findParameterValue(['username', 'uid', 'UID']); - $password = $findParameterValue(['password', 'pwd', 'PWD']); - $isPersistent = $findParameterValue(['persistent', 'PERSISTENT', 'Persistent']); - $options = (isset($p['driver_options']) ? $p['driver_options'] : []); - $connect = ((bool) $isPersistent) ? 'db2_pconnect' : 'db2_connect'; - - $this->resource = $connect($database, $username, $password, $options); - - if ($this->resource === false) { - throw new Exception\RuntimeException(sprintf( - '%s: Unable to connect to database', - __METHOD__ - )); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return ($this->resource !== null); - } - - /** - * {@inheritDoc} - */ - public function disconnect() - { - if ($this->resource) { - db2_close($this->resource); - $this->resource = null; - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if ($this->isI5() && ! ini_get('ibm_db2.i5_allow_commit')) { - throw new Exception\RuntimeException( - 'DB2 transactions are not enabled, you need to set the ibm_db2.i5_allow_commit=1 in your php.ini' - ); - } - - if (! $this->isConnected()) { - $this->connect(); - } - - $this->prevAutocommit = db2_autocommit($this->resource); - db2_autocommit($this->resource, DB2_AUTOCOMMIT_OFF); - $this->inTransaction = true; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if (! db2_commit($this->resource)) { - throw new Exception\RuntimeException("The commit has not been successful"); - } - - if ($this->prevAutocommit) { - db2_autocommit($this->resource, $this->prevAutocommit); - } - - $this->inTransaction = false; - - return $this; - } - - /** - * Rollback - * - * @return self Provides a fluent interface - * @throws Exception\RuntimeException - */ - public function rollback() - { - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback.'); - } - - if (! $this->inTransaction()) { - throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback.'); - } - - if (! db2_rollback($this->resource)) { - throw new Exception\RuntimeException('The rollback has not been successful'); - } - - if ($this->prevAutocommit) { - db2_autocommit($this->resource, $this->prevAutocommit); - } - - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - set_error_handler(function () { - }, E_WARNING); // suppress warnings - $resultResource = db2_exec($this->resource, $sql); - restore_error_handler(); - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - // if the returnValue is something other than a pg result resource, bypass wrapping it - if ($resultResource === false) { - throw new Exception\InvalidQueryException(db2_stmt_errormsg()); - } - - return $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); - } - - /** - * {@inheritDoc} - */ - public function getLastGeneratedValue($name = null) - { - return db2_last_insert_id($this->resource); - } - - /** - * Determine if the OS is OS400 (AS400, IBM i) - * - * @return bool - */ - protected function isI5() - { - if (isset($this->i5)) { - return $this->i5; - } - - $this->i5 = (php_uname('s') == 'OS400'); - - return $this->i5; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php deleted file mode 100644 index 11a064cc..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php +++ /dev/null @@ -1,214 +0,0 @@ -registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); - return $this; - } - - /** - * @param Statement $statementPrototype - * @return self Provides a fluent interface - */ - public function registerStatementPrototype(Statement $statementPrototype) - { - $this->statementPrototype = $statementPrototype; - $this->statementPrototype->setDriver($this); - return $this; - } - - /** - * @param Result $resultPrototype - * @return self Provides a fluent interface - */ - public function registerResultPrototype(Result $resultPrototype) - { - $this->resultPrototype = $resultPrototype; - return $this; - } - - /** - * Get database platform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { - return 'IbmDb2'; - } else { - return 'IBM DB2'; - } - } - - /** - * Check environment - * - * @return bool - */ - public function checkEnvironment() - { - if (! extension_loaded('ibm_db2')) { - throw new Exception\RuntimeException('The ibm_db2 extension is required by this driver.'); - } - } - - /** - * Get connection - * - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Create statement - * - * @param string|resource $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - $statement = clone $this->statementPrototype; - if (is_resource($sqlOrResource) && get_resource_type($sqlOrResource) == 'DB2 Statement') { - $statement->setResource($sqlOrResource); - } else { - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } elseif ($sqlOrResource !== null) { - throw new Exception\InvalidArgumentException( - __FUNCTION__ . ' only accepts an SQL string or an ibm_db2 resource' - ); - } - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - $statement->initialize($this->connection->getResource()); - } - return $statement; - } - - /** - * Create result - * - * @param resource $resource - * @return Result - */ - public function createResult($resource) - { - $result = clone $this->resultPrototype; - $result->initialize($resource, $this->connection->getLastGeneratedValue()); - return $result; - } - - /** - * Get prepare type - * - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_POSITIONAL; - } - - /** - * Format parameter name - * - * @param string $name - * @param mixed $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - return '?'; - } - - /** - * Get last generated value - * - * @return mixed - */ - public function getLastGeneratedValue() - { - return $this->connection->getLastGeneratedValue(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php deleted file mode 100644 index 2c8c900f..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php +++ /dev/null @@ -1,192 +0,0 @@ -resource = $resource; - $this->generatedValue = $generatedValue; - return $this; - } - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - public function current() - { - if ($this->currentComplete) { - return $this->currentData; - } - - $this->currentData = db2_fetch_assoc($this->resource); - return $this->currentData; - } - - /** - * @return mixed - */ - public function next() - { - $this->currentData = db2_fetch_assoc($this->resource); - $this->currentComplete = true; - $this->position++; - return $this->currentData; - } - - /** - * @return int|string - */ - public function key() - { - return $this->position; - } - - /** - * @return bool - */ - public function valid() - { - return ($this->currentData !== false); - } - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - public function rewind() - { - if ($this->position > 0) { - throw new Exception\RuntimeException( - 'This result is a forward only result set, calling rewind() after moving forward is not supported' - ); - } - $this->currentData = db2_fetch_assoc($this->resource); - $this->currentComplete = true; - $this->position = 1; - } - - /** - * Force buffering - * - * @return void - */ - public function buffer() - { - return; - } - - /** - * Check if is buffered - * - * @return bool|null - */ - public function isBuffered() - { - return false; - } - - /** - * Is query result? - * - * @return bool - */ - public function isQueryResult() - { - return (db2_num_fields($this->resource) > 0); - } - - /** - * Get affected rows - * - * @return int - */ - public function getAffectedRows() - { - return db2_num_rows($this->resource); - } - - /** - * Get generated value - * - * @return mixed|null - */ - public function getGeneratedValue() - { - return $this->generatedValue; - } - - /** - * Get the resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Get field count - * - * @return int - */ - public function getFieldCount() - { - return db2_num_fields($this->resource); - } - - /** - * @return null|int - */ - public function count() - { - return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php deleted file mode 100644 index a3b213d2..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php +++ /dev/null @@ -1,277 +0,0 @@ -db2 = $resource; - return $this; - } - - /** - * @param IbmDb2 $driver - * @return self Provides a fluent interface - */ - public function setDriver(IbmDb2 $driver) - { - $this->driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Set sql - * - * @param $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Get sql - * - * @return mixed - */ - public function getSql() - { - return $this->sql; - } - - /** - * Set parameter container - * - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * Get parameter container - * - * @return mixed - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * @param $resource - * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException - */ - public function setResource($resource) - { - if (get_resource_type($resource) !== 'DB2 Statement') { - throw new Exception\InvalidArgumentException('Resource must be of type DB2 Statement'); - } - $this->resource = $resource; - } - - /** - * Get resource - * - * @return resource - */ - public function getResource() - { - return $this->resource; - } - - /** - * Prepare sql - * - * @param string|null $sql - * @return self Provides a fluent interface - * @throws Exception\RuntimeException - */ - public function prepare($sql = null) - { - if ($this->isPrepared) { - throw new Exception\RuntimeException('This statement has been prepared already'); - } - - if ($sql === null) { - $sql = $this->sql; - } - - try { - set_error_handler($this->createErrorHandler()); - $this->resource = db2_prepare($this->db2, $sql); - } catch (ErrorException $e) { - throw new Exception\RuntimeException($e->getMessage() . '. ' . db2_stmt_errormsg(), db2_stmt_error(), $e); - } finally { - restore_error_handler(); - } - - if ($this->resource === false) { - throw new Exception\RuntimeException(db2_stmt_errormsg(), db2_stmt_error()); - } - - $this->isPrepared = true; - return $this; - } - - /** - * Check if is prepared - * - * @return bool - */ - public function isPrepared() - { - return $this->isPrepared; - } - - /** - * Execute - * - * @param null|array|ParameterContainer $parameters - * @return Result - */ - public function execute($parameters = null) - { - if (! $this->isPrepared) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - /** END Standard ParameterContainer Merging Block */ - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - set_error_handler(function () { - }, E_WARNING); // suppress warnings - $response = db2_execute($this->resource, $this->parameterContainer->getPositionalArray()); - restore_error_handler(); - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - if ($response === false) { - throw new Exception\RuntimeException(db2_stmt_errormsg($this->resource)); - } - - $result = $this->driver->createResult($this->resource); - return $result; - } - - /** - * Creates and returns a callable error handler that raises exceptions. - * - * Only raises exceptions for errors that are within the error_reporting mask. - * - * @return callable - */ - private function createErrorHandler() - { - /** - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @return void - * @throws ErrorException if error is not within the error_reporting mask. - */ - return function ($errno, $errstr, $errfile, $errline) { - if (! (error_reporting() & $errno)) { - // error_reporting does not include this error - return; - } - - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); - }; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php deleted file mode 100644 index c94e0096..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php +++ /dev/null @@ -1,285 +0,0 @@ -setConnectionParameters($connectionInfo); - } elseif ($connectionInfo instanceof \mysqli) { - $this->setResource($connectionInfo); - } elseif (null !== $connectionInfo) { - throw new Exception\InvalidArgumentException( - '$connection must be an array of parameters, a mysqli object or null' - ); - } - } - - /** - * @param Mysqli $driver - * @return self Provides a fluent interface - */ - public function setDriver(Mysqli $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $result = $this->resource->query('SELECT DATABASE()'); - $r = $result->fetch_row(); - - return $r[0]; - } - - /** - * Set resource - * - * @param \mysqli $resource - * @return self Provides a fluent interface - */ - public function setResource(\mysqli $resource) - { - $this->resource = $resource; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function connect() - { - if ($this->resource instanceof \mysqli) { - return $this; - } - - // localize - $p = $this->connectionParameters; - - // given a list of key names, test for existence in $p - $findParameterValue = function (array $names) use ($p) { - foreach ($names as $name) { - if (isset($p[$name])) { - return $p[$name]; - } - } - - return; - }; - - $hostname = $findParameterValue(['hostname', 'host']); - $username = $findParameterValue(['username', 'user']); - $password = $findParameterValue(['password', 'passwd', 'pw']); - $database = $findParameterValue(['database', 'dbname', 'db', 'schema']); - $port = (isset($p['port'])) ? (int) $p['port'] : null; - $socket = (isset($p['socket'])) ? $p['socket'] : null; - - $useSSL = (isset($p['use_ssl'])) ? $p['use_ssl'] : 0; - $clientKey = (isset($p['client_key'])) ? $p['client_key'] : null; - $clientCert = (isset($p['client_cert'])) ? $p['client_cert'] : null; - $caCert = (isset($p['ca_cert'])) ? $p['ca_cert'] : null; - $caPath = (isset($p['ca_path'])) ? $p['ca_path'] : null; - $cipher = (isset($p['cipher'])) ? $p['cipher'] : null; - - $this->resource = new \mysqli(); - $this->resource->init(); - - if (! empty($p['driver_options'])) { - foreach ($p['driver_options'] as $option => $value) { - if (is_string($option)) { - $option = strtoupper($option); - if (! defined($option)) { - continue; - } - $option = constant($option); - } - $this->resource->options($option, $value); - } - } - - $flags = null; - - if ($useSSL && ! $socket) { - $this->resource->ssl_set($clientKey, $clientCert, $caCert, $caPath, $cipher); - //MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT is not valid option, needs to be set as flag - if (isset($p['driver_options']) - && isset($p['driver_options'][MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT]) - ) { - $flags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; - } - } - - - try { - $this->resource->real_connect($hostname, $username, $password, $database, $port, $socket, $flags); - } catch (GenericException $e) { - throw new Exception\RuntimeException( - 'Connection error', - null, - new Exception\ErrorException($this->resource->connect_error, $this->resource->connect_errno) - ); - } - - if ($this->resource->connect_error) { - throw new Exception\RuntimeException( - 'Connection error', - null, - new Exception\ErrorException($this->resource->connect_error, $this->resource->connect_errno) - ); - } - - if (! empty($p['charset'])) { - $this->resource->set_charset($p['charset']); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return ($this->resource instanceof \mysqli); - } - - /** - * {@inheritDoc} - */ - public function disconnect() - { - if ($this->resource instanceof \mysqli) { - $this->resource->close(); - } - $this->resource = null; - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $this->resource->autocommit(false); - $this->inTransaction = true; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $this->resource->commit(); - $this->inTransaction = false; - $this->resource->autocommit(true); - - return $this; - } - - /** - * {@inheritDoc} - */ - public function rollback() - { - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback.'); - } - - if (! $this->inTransaction) { - throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback.'); - } - - $this->resource->rollback(); - $this->resource->autocommit(true); - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\InvalidQueryException - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - $resultResource = $this->resource->query($sql); - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - // if the returnValue is something other than a mysqli_result, bypass wrapping it - if ($resultResource === false) { - throw new Exception\InvalidQueryException($this->resource->error); - } - - $resultPrototype = $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); - - return $resultPrototype; - } - - /** - * {@inheritDoc} - */ - public function getLastGeneratedValue($name = null) - { - return $this->resource->insert_id; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php deleted file mode 100644 index c1f3da51..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php +++ /dev/null @@ -1,262 +0,0 @@ - false - ]; - - /** - * Constructor - * - * @param array|Connection|\mysqli $connection - * @param null|Statement $statementPrototype - * @param null|Result $resultPrototype - * @param array $options - */ - public function __construct( - $connection, - Statement $statementPrototype = null, - Result $resultPrototype = null, - array $options = [] - ) { - if (! $connection instanceof Connection) { - $connection = new Connection($connection); - } - - $options = array_intersect_key(array_merge($this->options, $options), $this->options); - - $this->registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement($options['buffer_results'])); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Register connection - * - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); // needs access to driver to createStatement() - return $this; - } - - /** - * Register statement prototype - * - * @param Statement $statementPrototype - */ - public function registerStatementPrototype(Statement $statementPrototype) - { - $this->statementPrototype = $statementPrototype; - $this->statementPrototype->setDriver($this); // needs access to driver to createResult() - } - - /** - * Get statement prototype - * - * @return null|Statement - */ - public function getStatementPrototype() - { - return $this->statementPrototype; - } - - /** - * Register result prototype - * - * @param Result $resultPrototype - */ - public function registerResultPrototype(Result $resultPrototype) - { - $this->resultPrototype = $resultPrototype; - } - - /** - * @return null|Result - */ - public function getResultPrototype() - { - return $this->resultPrototype; - } - - /** - * Get database platform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { - return 'Mysql'; - } - - return 'MySQL'; - } - - /** - * Check environment - * - * @throws Exception\RuntimeException - * @return void - */ - public function checkEnvironment() - { - if (! extension_loaded('mysqli')) { - throw new Exception\RuntimeException( - 'The Mysqli extension is required for this adapter but the extension is not loaded' - ); - } - } - - /** - * Get connection - * - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Create statement - * - * @param string $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - /** - * @todo Resource tracking - if (is_resource($sqlOrResource) && !in_array($sqlOrResource, $this->resources, true)) { - $this->resources[] = $sqlOrResource; - } - */ - - $statement = clone $this->statementPrototype; - if ($sqlOrResource instanceof mysqli_stmt) { - $statement->setResource($sqlOrResource); - } else { - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - $statement->initialize($this->connection->getResource()); - } - return $statement; - } - - /** - * Create result - * - * @param resource $resource - * @param null|bool $isBuffered - * @return Result - */ - public function createResult($resource, $isBuffered = null) - { - $result = clone $this->resultPrototype; - $result->initialize($resource, $this->connection->getLastGeneratedValue(), $isBuffered); - return $result; - } - - /** - * Get prepare type - * - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_POSITIONAL; - } - - /** - * Format parameter name - * - * @param string $name - * @param mixed $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - return '?'; - } - - /** - * Get last generated value - * - * @return mixed - */ - public function getLastGeneratedValue() - { - return $this->getConnection()->getLastGeneratedValue(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php deleted file mode 100644 index eb388eeb..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php +++ /dev/null @@ -1,342 +0,0 @@ - null, 'values' => []]; - - /** - * @var mixed - */ - protected $generatedValue = null; - - /** - * Initialize - * - * @param mixed $resource - * @param mixed $generatedValue - * @param bool|null $isBuffered - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function initialize($resource, $generatedValue, $isBuffered = null) - { - if (! $resource instanceof \mysqli - && ! $resource instanceof \mysqli_result - && ! $resource instanceof \mysqli_stmt - ) { - throw new Exception\InvalidArgumentException('Invalid resource provided.'); - } - - if ($isBuffered !== null) { - $this->isBuffered = $isBuffered; - } else { - if ($resource instanceof \mysqli || $resource instanceof \mysqli_result - || $resource instanceof \mysqli_stmt && $resource->num_rows != 0) { - $this->isBuffered = true; - } - } - - $this->resource = $resource; - $this->generatedValue = $generatedValue; - return $this; - } - - /** - * Force buffering - * - * @throws Exception\RuntimeException - */ - public function buffer() - { - if ($this->resource instanceof \mysqli_stmt && $this->isBuffered !== true) { - if ($this->position > 0) { - throw new Exception\RuntimeException('Cannot buffer a result set that has started iteration.'); - } - $this->resource->store_result(); - $this->isBuffered = true; - } - } - - /** - * Check if is buffered - * - * @return bool|null - */ - public function isBuffered() - { - return $this->isBuffered; - } - - /** - * Return the resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Is query result? - * - * @return bool - */ - public function isQueryResult() - { - return ($this->resource->field_count > 0); - } - - /** - * Get affected rows - * - * @return int - */ - public function getAffectedRows() - { - if ($this->resource instanceof \mysqli || $this->resource instanceof \mysqli_stmt) { - return $this->resource->affected_rows; - } - - return $this->resource->num_rows; - } - - /** - * Current - * - * @return mixed - */ - public function current() - { - if ($this->currentComplete) { - return $this->currentData; - } - - if ($this->resource instanceof \mysqli_stmt) { - $this->loadDataFromMysqliStatement(); - return $this->currentData; - } else { - $this->loadFromMysqliResult(); - return $this->currentData; - } - } - - /** - * Mysqli's binding and returning of statement values - * - * Mysqli requires you to bind variables to the extension in order to - * get data out. These values have to be references: - * @see http://php.net/manual/en/mysqli-stmt.bind-result.php - * - * @throws Exception\RuntimeException - * @return bool - */ - protected function loadDataFromMysqliStatement() - { - // build the default reference based bind structure, if it does not already exist - if ($this->statementBindValues['keys'] === null) { - $this->statementBindValues['keys'] = []; - $resultResource = $this->resource->result_metadata(); - foreach ($resultResource->fetch_fields() as $col) { - $this->statementBindValues['keys'][] = $col->name; - } - $this->statementBindValues['values'] = array_fill(0, count($this->statementBindValues['keys']), null); - $refs = []; - foreach ($this->statementBindValues['values'] as $i => &$f) { - $refs[$i] = &$f; - } - call_user_func_array([$this->resource, 'bind_result'], $this->statementBindValues['values']); - } - - if (($r = $this->resource->fetch()) === null) { - if (! $this->isBuffered) { - $this->resource->close(); - } - return false; - } elseif ($r === false) { - throw new Exception\RuntimeException($this->resource->error); - } - - // dereference - for ($i = 0, $count = count($this->statementBindValues['keys']); $i < $count; $i++) { - $this->currentData[$this->statementBindValues['keys'][$i]] = $this->statementBindValues['values'][$i]; - } - $this->currentComplete = true; - $this->nextComplete = true; - $this->position++; - return true; - } - - /** - * Load from mysqli result - * - * @return bool - */ - protected function loadFromMysqliResult() - { - $this->currentData = null; - - if (($data = $this->resource->fetch_assoc()) === null) { - return false; - } - - $this->position++; - $this->currentData = $data; - $this->currentComplete = true; - $this->nextComplete = true; - $this->position++; - return true; - } - - /** - * Next - * - * @return void - */ - public function next() - { - $this->currentComplete = false; - - if ($this->nextComplete == false) { - $this->position++; - } - - $this->nextComplete = false; - } - - /** - * Key - * - * @return mixed - */ - public function key() - { - return $this->position; - } - - /** - * Rewind - * - * @throws Exception\RuntimeException - * @return void - */ - public function rewind() - { - if (0 !== $this->position && false === $this->isBuffered) { - throw new Exception\RuntimeException('Unbuffered results cannot be rewound for multiple iterations'); - } - - $this->resource->data_seek(0); // works for both mysqli_result & mysqli_stmt - $this->currentComplete = false; - $this->position = 0; - } - - /** - * Valid - * - * @return bool - */ - public function valid() - { - if ($this->currentComplete) { - return true; - } - - if ($this->resource instanceof \mysqli_stmt) { - return $this->loadDataFromMysqliStatement(); - } - - return $this->loadFromMysqliResult(); - } - - /** - * Count - * - * @throws Exception\RuntimeException - * @return int - */ - public function count() - { - if ($this->isBuffered === false) { - throw new Exception\RuntimeException('Row count is not available in unbuffered result sets.'); - } - return $this->resource->num_rows; - } - - /** - * Get field count - * - * @return int - */ - public function getFieldCount() - { - return $this->resource->field_count; - } - - /** - * Get generated value - * - * @return mixed|null - */ - public function getGeneratedValue() - { - return $this->generatedValue; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php deleted file mode 100644 index 140d4aac..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php +++ /dev/null @@ -1,315 +0,0 @@ -bufferResults = (bool) $bufferResults; - } - - /** - * Set driver - * - * @param Mysqli $driver - * @return self Provides a fluent interface - */ - public function setDriver(Mysqli $driver) - { - $this->driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Initialize - * - * @param \mysqli $mysqli - * @return self Provides a fluent interface - */ - public function initialize(\mysqli $mysqli) - { - $this->mysqli = $mysqli; - return $this; - } - - /** - * Set sql - * - * @param string $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Set Parameter container - * - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * Get resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Set resource - * - * @param \mysqli_stmt $mysqliStatement - * @return self Provides a fluent interface - */ - public function setResource(\mysqli_stmt $mysqliStatement) - { - $this->resource = $mysqliStatement; - $this->isPrepared = true; - return $this; - } - - /** - * Get sql - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Get parameter count - * - * @return ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * Is prepared - * - * @return bool - */ - public function isPrepared() - { - return $this->isPrepared; - } - - /** - * Prepare - * - * @param string $sql - * @return self Provides a fluent interface - * @throws Exception\InvalidQueryException - * @throws Exception\RuntimeException - */ - public function prepare($sql = null) - { - if ($this->isPrepared) { - throw new Exception\RuntimeException('This statement has already been prepared'); - } - - $sql = ($sql) ?: $this->sql; - - $this->resource = $this->mysqli->prepare($sql); - if (! $this->resource instanceof \mysqli_stmt) { - throw new Exception\InvalidQueryException( - 'Statement couldn\'t be produced with sql: ' . $sql, - null, - new Exception\ErrorException($this->mysqli->error, $this->mysqli->errno) - ); - } - - $this->isPrepared = true; - return $this; - } - - /** - * Execute - * - * @param null|array|ParameterContainer $parameters - * @throws Exception\RuntimeException - * @return mixed - */ - public function execute($parameters = null) - { - if (! $this->isPrepared) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - - if ($this->parameterContainer->count() > 0) { - $this->bindParametersFromContainer(); - } - /** END Standard ParameterContainer Merging Block */ - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - $return = $this->resource->execute(); - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - if ($return === false) { - throw new Exception\RuntimeException($this->resource->error); - } - - if ($this->bufferResults === true) { - $this->resource->store_result(); - $this->isPrepared = false; - $buffered = true; - } else { - $buffered = false; - } - - $result = $this->driver->createResult($this->resource, $buffered); - return $result; - } - - /** - * Bind parameters from container - * - * @return void - */ - protected function bindParametersFromContainer() - { - $parameters = $this->parameterContainer->getNamedArray(); - $type = ''; - $args = []; - - foreach ($parameters as $name => &$value) { - if ($this->parameterContainer->offsetHasErrata($name)) { - switch ($this->parameterContainer->offsetGetErrata($name)) { - case ParameterContainer::TYPE_DOUBLE: - $type .= 'd'; - break; - case ParameterContainer::TYPE_NULL: - $value = null; // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148 - case ParameterContainer::TYPE_INTEGER: - $type .= 'i'; - break; - case ParameterContainer::TYPE_STRING: - default: - $type .= 's'; - break; - } - } else { - $type .= 's'; - } - $args[] = &$value; - } - - if ($args) { - array_unshift($args, $type); - call_user_func_array([$this->resource, 'bind_param'], $args); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php deleted file mode 100644 index 761a2a6c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php +++ /dev/null @@ -1,268 +0,0 @@ -setConnectionParameters($connectionInfo); - } elseif ($connectionInfo instanceof \oci8) { - $this->setResource($connectionInfo); - } elseif (null !== $connectionInfo) { - throw new Exception\InvalidArgumentException( - '$connection must be an array of parameters, an oci8 resource or null' - ); - } - } - - /** - * @param Oci8 $driver - * @return self Provides a fluent interface - */ - public function setDriver(Oci8 $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $query = "SELECT sys_context('USERENV', 'CURRENT_SCHEMA') as \"current_schema\" FROM DUAL"; - $stmt = oci_parse($this->resource, $query); - oci_execute($stmt); - $dbNameArray = oci_fetch_array($stmt, OCI_ASSOC); - - return $dbNameArray['current_schema']; - } - - /** - * Set resource - * - * @param resource $resource - * @return self Provides a fluent interface - */ - public function setResource($resource) - { - if (! is_resource($resource) || get_resource_type($resource) !== 'oci8 connection') { - throw new Exception\InvalidArgumentException('A resource of type "oci8 connection" was expected'); - } - $this->resource = $resource; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function connect() - { - if (is_resource($this->resource)) { - return $this; - } - - // localize - $p = $this->connectionParameters; - - // given a list of key names, test for existence in $p - $findParameterValue = function (array $names) use ($p) { - foreach ($names as $name) { - if (isset($p[$name])) { - return $p[$name]; - } - } - - return; - }; - - // http://www.php.net/manual/en/function.oci-connect.php - $username = $findParameterValue(['username']); - $password = $findParameterValue(['password']); - $connectionString = $findParameterValue([ - 'connection_string', - 'connectionstring', - 'connection', - 'hostname', - 'instance' - ]); - $characterSet = $findParameterValue(['character_set', 'charset', 'encoding']); - $sessionMode = $findParameterValue(['session_mode']); - - // connection modifiers - $isUnique = $findParameterValue(['unique']); - $isPersistent = $findParameterValue(['persistent']); - - if ($isUnique == true) { - $this->resource = oci_new_connect($username, $password, $connectionString, $characterSet, $sessionMode); - } elseif ($isPersistent == true) { - $this->resource = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode); - } else { - $this->resource = oci_connect($username, $password, $connectionString, $characterSet, $sessionMode); - } - - if (! $this->resource) { - $e = oci_error(); - throw new Exception\RuntimeException( - 'Connection error', - null, - new Exception\ErrorException($e['message'], $e['code']) - ); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return (is_resource($this->resource)); - } - - /** - * {@inheritDoc} - */ - public function disconnect() - { - if (is_resource($this->resource)) { - oci_close($this->resource); - } - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if (! $this->isConnected()) { - $this->connect(); - } - - // A transaction begins when the first SQL statement that changes data is executed with oci_execute() using - // the OCI_NO_AUTO_COMMIT flag. - $this->inTransaction = true; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->inTransaction()) { - $valid = oci_commit($this->resource); - if ($valid === false) { - $e = oci_error($this->resource); - throw new Exception\InvalidQueryException($e['message'], $e['code']); - } - - $this->inTransaction = false; - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function rollback() - { - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback.'); - } - - if (! $this->inTransaction()) { - throw new Exception\RuntimeException('Must call commit() before you can rollback.'); - } - - $valid = oci_rollback($this->resource); - if ($valid === false) { - $e = oci_error($this->resource); - throw new Exception\InvalidQueryException($e['message'], $e['code']); - } - - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - $ociStmt = oci_parse($this->resource, $sql); - - if ($this->inTransaction) { - $valid = @oci_execute($ociStmt, OCI_NO_AUTO_COMMIT); - } else { - $valid = @oci_execute($ociStmt, OCI_COMMIT_ON_SUCCESS); - } - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - if ($valid === false) { - $e = oci_error($ociStmt); - throw new Exception\InvalidQueryException($e['message'], $e['code']); - } - - $resultPrototype = $this->driver->createResult($ociStmt); - - return $resultPrototype; - } - - /** - * {@inheritDoc} - */ - public function getLastGeneratedValue($name = null) - { - // @todo Get Last Generated Value in Connection (this might not apply) - return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php deleted file mode 100644 index bd55f065..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php +++ /dev/null @@ -1,75 +0,0 @@ -getSql(); - if ($sql == '' || stripos(strtolower($sql), 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; - $countStmt->prepare($countSql); - $result = $countStmt->execute(); - $countRow = $result->current(); - return $countRow['count']; - } - - /** - * @param string $sql - * @return null|int - */ - public function getCountForSql($sql) - { - if (stripos(strtolower($sql), 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; - $result = $this->driver->getConnection()->execute($countSql); - $countRow = $result->current(); - return $countRow['count']; - } - - /** - * @param \Zend\Db\Adapter\Driver\Oci8\Statement|string $context - * @return callable - */ - public function getRowCountClosure($context) - { - $rowCounter = $this; - return function () use ($rowCounter, $context) { - /** @var $rowCounter RowCounter */ - return ($context instanceof Statement) - ? $rowCounter->getCountForStatement($context) - : $rowCounter->getCountForSql($context); - }; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php deleted file mode 100644 index 3f0ba5af..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php +++ /dev/null @@ -1,302 +0,0 @@ -options, $options), $this->options); - $this->registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - if (is_array($features)) { - foreach ($features as $name => $feature) { - $this->addFeature($name, $feature); - } - } elseif ($features instanceof AbstractFeature) { - $this->addFeature($features->getName(), $features); - } elseif ($features === self::FEATURES_DEFAULT) { - $this->setupDefaultFeatures(); - } - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Register connection - * - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); // needs access to driver to createStatement() - return $this; - } - - /** - * Register statement prototype - * - * @param Statement $statementPrototype - * @return self Provides a fluent interface - */ - public function registerStatementPrototype(Statement $statementPrototype) - { - $this->statementPrototype = $statementPrototype; - $this->statementPrototype->setDriver($this); // needs access to driver to createResult() - return $this; - } - - /** - * @return null|Statement - */ - public function getStatementPrototype() - { - return $this->statementPrototype; - } - - /** - * Register result prototype - * - * @param Result $resultPrototype - * @return self Provides a fluent interface - */ - public function registerResultPrototype(Result $resultPrototype) - { - $this->resultPrototype = $resultPrototype; - return $this; - } - - /** - * @return null|Result - */ - public function getResultPrototype() - { - return $this->resultPrototype; - } - - /** - * Add feature - * - * @param string $name - * @param AbstractFeature $feature - * @return self Provides a fluent interface - */ - public function addFeature($name, $feature) - { - if ($feature instanceof AbstractFeature) { - $name = $feature->getName(); // overwrite the name, just in case - $feature->setDriver($this); - } - $this->features[$name] = $feature; - return $this; - } - - /** - * Setup the default features for Pdo - * - * @return self Provides a fluent interface - */ - public function setupDefaultFeatures() - { - $this->addFeature(null, new Feature\RowCounter()); - return $this; - } - - /** - * Get feature - * - * @param string $name - * @return AbstractFeature|false - */ - public function getFeature($name) - { - if (isset($this->features[$name])) { - return $this->features[$name]; - } - return false; - } - - /** - * Get database platform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - return 'Oracle'; - } - - /** - * Check environment - */ - public function checkEnvironment() - { - if (! extension_loaded('oci8')) { - throw new Exception\RuntimeException( - 'The Oci8 extension is required for this adapter but the extension is not loaded' - ); - } - } - - /** - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * @param string $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - $statement = clone $this->statementPrototype; - if (is_resource($sqlOrResource) && get_resource_type($sqlOrResource) == 'oci8 statement') { - $statement->setResource($sqlOrResource); - } else { - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } elseif ($sqlOrResource !== null) { - throw new Exception\InvalidArgumentException( - 'Oci8 only accepts an SQL string or an oci8 resource in ' . __FUNCTION__ - ); - } - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - $statement->initialize($this->connection->getResource()); - } - return $statement; - } - - /** - * @param resource $resource - * @param null $context - * @return Result - */ - public function createResult($resource, $context = null) - { - $result = clone $this->resultPrototype; - $rowCount = null; - // special feature, oracle Oci counter - if ($context && ($rowCounter = $this->getFeature('RowCounter')) && oci_num_fields($resource) > 0) { - $rowCount = $rowCounter->getRowCountClosure($context); - } - $result->initialize($resource, null, $rowCount); - return $result; - } - - /** - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_NAMED; - } - - /** - * @param string $name - * @param mixed $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - return ':' . $name; - } - - /** - * @return mixed - */ - public function getLastGeneratedValue() - { - return $this->getConnection()->getLastGeneratedValue(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php deleted file mode 100644 index 4f27adce..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php +++ /dev/null @@ -1,231 +0,0 @@ - null, 'values' => []]; - - /** - * @var mixed - */ - protected $generatedValue = null; - - /** - * Initialize - * @param resource $resource - * @param null|int $generatedValue - * @param null|int $rowCount - * @return self Provides a fluent interface - */ - public function initialize($resource, $generatedValue = null, $rowCount = null) - { - if (! is_resource($resource) && get_resource_type($resource) !== 'oci8 statement') { - throw new Exception\InvalidArgumentException('Invalid resource provided.'); - } - $this->resource = $resource; - $this->generatedValue = $generatedValue; - $this->rowCount = $rowCount; - return $this; - } - - /** - * Force buffering at driver level - * - * Oracle does not support this, to my knowledge (@ralphschindler) - * - * @throws Exception\RuntimeException - */ - public function buffer() - { - return; - } - - /** - * Is the result buffered? - * - * @return bool - */ - public function isBuffered() - { - return false; - } - - /** - * Return the resource - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Is query result? - * - * @return bool - */ - public function isQueryResult() - { - return (oci_num_fields($this->resource) > 0); - } - - /** - * Get affected rows - * @return int - */ - public function getAffectedRows() - { - return oci_num_rows($this->resource); - } - - /** - * Current - * @return mixed - */ - public function current() - { - if ($this->currentComplete == false) { - if ($this->loadData() === false) { - return false; - } - } - return $this->currentData; - } - - /** - * Load from oci8 result - * - * @return bool - */ - protected function loadData() - { - $this->currentComplete = true; - $this->currentData = oci_fetch_assoc($this->resource); - if ($this->currentData !== false) { - $this->position++; - return true; - } - return false; - } - - /** - * Next - */ - public function next() - { - return $this->loadData(); - } - - /** - * Key - * @return mixed - */ - public function key() - { - return $this->position; - } - - /** - * Rewind - */ - public function rewind() - { - if ($this->position > 0) { - throw new Exception\RuntimeException('Oci8 results cannot be rewound for multiple iterations'); - } - } - - /** - * Valid - * @return bool - */ - public function valid() - { - if ($this->currentComplete) { - return ($this->currentData !== false); - } - return $this->loadData(); - } - - /** - * Count - * @return null|int - */ - public function count() - { - if (is_int($this->rowCount)) { - return $this->rowCount; - } - if (is_callable($this->rowCount)) { - $this->rowCount = (int) call_user_func($this->rowCount); - return $this->rowCount; - } - return; - } - - /** - * @return int - */ - public function getFieldCount() - { - return oci_num_fields($this->resource); - } - - /** - * @return null - */ - public function getGeneratedValue() - { - // @todo OCI8 generated value in Driver Result - return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php deleted file mode 100644 index 2d8ca1ee..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php +++ /dev/null @@ -1,327 +0,0 @@ -driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Initialize - * - * @param resource $oci8 - * @return self Provides a fluent interface - */ - public function initialize($oci8) - { - $this->oci8 = $oci8; - return $this; - } - - /** - * Set sql - * - * @param string $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Set Parameter container - * - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * Get resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Set resource - * - * @param resource $oci8Statement - * @return self Provides a fluent interface - */ - public function setResource($oci8Statement) - { - $type = oci_statement_type($oci8Statement); - if (false === $type || 'UNKNOWN' == $type) { - throw new Exception\InvalidArgumentException(sprintf( - 'Invalid statement provided to %s', - __METHOD__ - )); - } - $this->resource = $oci8Statement; - $this->isPrepared = true; - return $this; - } - - /** - * Get sql - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * @return ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * @return bool - */ - public function isPrepared() - { - return $this->isPrepared; - } - - /** - * @param string $sql - * @return self Provides a fluent interface - */ - public function prepare($sql = null) - { - if ($this->isPrepared) { - throw new Exception\RuntimeException('This statement has already been prepared'); - } - - $sql = ($sql) ?: $this->sql; - - // get oci8 statement resource - $this->resource = oci_parse($this->oci8, $sql); - - if (! $this->resource) { - $e = oci_error($this->oci8); - throw new Exception\InvalidQueryException( - 'Statement couldn\'t be produced with sql: ' . $sql, - null, - new Exception\ErrorException($e['message'], $e['code']) - ); - } - - $this->isPrepared = true; - return $this; - } - - /** - * Execute - * - * @param null|array|ParameterContainer $parameters - * @return mixed - */ - public function execute($parameters = null) - { - if (! $this->isPrepared) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - - if ($this->parameterContainer->count() > 0) { - $this->bindParametersFromContainer(); - } - /** END Standard ParameterContainer Merging Block */ - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - if ($this->driver->getConnection()->inTransaction()) { - $ret = @oci_execute($this->resource, OCI_NO_AUTO_COMMIT); - } else { - $ret = @oci_execute($this->resource, OCI_COMMIT_ON_SUCCESS); - } - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - if ($ret === false) { - $e = oci_error($this->resource); - throw new Exception\RuntimeException($e['message'], $e['code']); - } - - $result = $this->driver->createResult($this->resource, $this); - return $result; - } - - /** - * Bind parameters from container - */ - protected function bindParametersFromContainer() - { - $parameters = $this->parameterContainer->getNamedArray(); - - foreach ($parameters as $name => &$value) { - if ($this->parameterContainer->offsetHasErrata($name)) { - switch ($this->parameterContainer->offsetGetErrata($name)) { - case ParameterContainer::TYPE_NULL: - $type = null; - $value = null; - break; - case ParameterContainer::TYPE_DOUBLE: - case ParameterContainer::TYPE_INTEGER: - $type = SQLT_INT; - if (is_string($value)) { - $value = (int) $value; - } - break; - case ParameterContainer::TYPE_BINARY: - $type = SQLT_BIN; - break; - case ParameterContainer::TYPE_LOB: - $type = OCI_B_CLOB; - $clob = oci_new_descriptor($this->driver->getConnection()->getResource(), OCI_DTYPE_LOB); - $clob->writetemporary($value, OCI_TEMP_CLOB); - $value = $clob; - break; - case ParameterContainer::TYPE_STRING: - default: - $type = SQLT_CHR; - break; - } - } else { - $type = SQLT_CHR; - } - - $maxLength = -1; - if ($this->parameterContainer->offsetHasMaxLength($name)) { - $maxLength = $this->parameterContainer->offsetGetMaxLength($name); - } - - oci_bind_by_name($this->resource, $name, $value, $maxLength, $type); - } - } - - /** - * Perform a deep clone - */ - public function __clone() - { - $this->isPrepared = false; - $this->parametersBound = false; - $this->resource = null; - if ($this->parameterContainer) { - $this->parameterContainer = clone $this->parameterContainer; - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php deleted file mode 100644 index 5f2f6174..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php +++ /dev/null @@ -1,432 +0,0 @@ -setConnectionParameters($connectionParameters); - } elseif ($connectionParameters instanceof \PDO) { - $this->setResource($connectionParameters); - } elseif (null !== $connectionParameters) { - throw new Exception\InvalidArgumentException( - '$connection must be an array of parameters, a PDO object or null' - ); - } - } - - /** - * Set driver - * - * @param Pdo $driver - * @return self Provides a fluent interface - */ - public function setDriver(Pdo $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function setConnectionParameters(array $connectionParameters) - { - $this->connectionParameters = $connectionParameters; - if (isset($connectionParameters['dsn'])) { - $this->driverName = substr( - $connectionParameters['dsn'], - 0, - strpos($connectionParameters['dsn'], ':') - ); - } elseif (isset($connectionParameters['pdodriver'])) { - $this->driverName = strtolower($connectionParameters['pdodriver']); - } elseif (isset($connectionParameters['driver'])) { - $this->driverName = strtolower(substr( - str_replace(['-', '_', ' '], '', $connectionParameters['driver']), - 3 - )); - } - } - - /** - * Get the dsn string for this connection - * @throws \Zend\Db\Adapter\Exception\RunTimeException - * @return string - */ - public function getDsn() - { - if (! $this->dsn) { - throw new Exception\RuntimeException( - 'The DSN has not been set or constructed from parameters in connect() for this Connection' - ); - } - - return $this->dsn; - } - - /** - * {@inheritDoc} - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - switch ($this->driverName) { - case 'mysql': - $sql = 'SELECT DATABASE()'; - break; - case 'sqlite': - return 'main'; - case 'sqlsrv': - case 'dblib': - $sql = 'SELECT SCHEMA_NAME()'; - break; - case 'pgsql': - default: - $sql = 'SELECT CURRENT_SCHEMA'; - break; - } - - /** @var $result \PDOStatement */ - $result = $this->resource->query($sql); - if ($result instanceof \PDOStatement) { - return $result->fetchColumn(); - } - - return false; - } - - /** - * Set resource - * - * @param \PDO $resource - * @return self Provides a fluent interface - */ - public function setResource(\PDO $resource) - { - $this->resource = $resource; - $this->driverName = strtolower($this->resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\InvalidConnectionParametersException - * @throws Exception\RuntimeException - */ - public function connect() - { - if ($this->resource) { - return $this; - } - - $dsn = $username = $password = $hostname = $database = null; - $options = []; - foreach ($this->connectionParameters as $key => $value) { - switch (strtolower($key)) { - case 'dsn': - $dsn = $value; - break; - case 'driver': - $value = strtolower((string) $value); - if (strpos($value, 'pdo') === 0) { - $pdoDriver = str_replace(['-', '_', ' '], '', $value); - $pdoDriver = substr($pdoDriver, 3) ?: ''; - } - break; - case 'pdodriver': - $pdoDriver = (string) $value; - break; - case 'user': - case 'username': - $username = (string) $value; - break; - case 'pass': - case 'password': - $password = (string) $value; - break; - case 'host': - case 'hostname': - $hostname = (string) $value; - break; - case 'port': - $port = (int) $value; - break; - case 'database': - case 'dbname': - $database = (string) $value; - break; - case 'charset': - $charset = (string) $value; - break; - case 'unix_socket': - $unix_socket = (string) $value; - break; - case 'version': - $version = (string) $value; - break; - case 'driver_options': - case 'options': - $value = (array) $value; - $options = array_diff_key($options, $value) + $value; - break; - default: - $options[$key] = $value; - break; - } - } - - if (isset($hostname) && isset($unix_socket)) { - throw new Exception\InvalidConnectionParametersException( - 'Ambiguous connection parameters, both hostname and unix_socket parameters were set', - $this->connectionParameters - ); - } - - if (! isset($dsn) && isset($pdoDriver)) { - $dsn = []; - switch ($pdoDriver) { - case 'sqlite': - $dsn[] = $database; - break; - case 'sqlsrv': - if (isset($database)) { - $dsn[] = "database={$database}"; - } - if (isset($hostname)) { - $dsn[] = "server={$hostname}"; - } - break; - default: - if (isset($database)) { - $dsn[] = "dbname={$database}"; - } - if (isset($hostname)) { - $dsn[] = "host={$hostname}"; - } - if (isset($port)) { - $dsn[] = "port={$port}"; - } - if (isset($charset) && $pdoDriver != 'pgsql') { - $dsn[] = "charset={$charset}"; - } - if (isset($unix_socket)) { - $dsn[] = "unix_socket={$unix_socket}"; - } - if (isset($version)) { - $dsn[] = "version={$version}"; - } - break; - } - $dsn = $pdoDriver . ':' . implode(';', $dsn); - } elseif (! isset($dsn)) { - throw new Exception\InvalidConnectionParametersException( - 'A dsn was not provided or could not be constructed from your parameters', - $this->connectionParameters - ); - } - - $this->dsn = $dsn; - - try { - $this->resource = new \PDO($dsn, $username, $password, $options); - $this->resource->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - if (isset($charset) && $pdoDriver == 'pgsql') { - $this->resource->exec('SET NAMES ' . $this->resource->quote($charset)); - } - $this->driverName = strtolower($this->resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); - } catch (\PDOException $e) { - $code = $e->getCode(); - if (! is_long($code)) { - $code = null; - } - throw new Exception\RuntimeException('Connect Error: ' . $e->getMessage(), $code, $e); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return ($this->resource instanceof \PDO); - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if (0 === $this->nestedTransactionsCount) { - $this->resource->beginTransaction(); - $this->inTransaction = true; - } - - $this->nestedTransactionsCount ++; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->inTransaction) { - $this->nestedTransactionsCount -= 1; - } - - /* - * This shouldn't check for being in a transaction since - * after issuing a SET autocommit=0; we have to commit too. - */ - if (0 === $this->nestedTransactionsCount) { - $this->resource->commit(); - $this->inTransaction = false; - } - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function rollback() - { - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback'); - } - - if (! $this->inTransaction()) { - throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback'); - } - - $this->resource->rollBack(); - - $this->inTransaction = false; - $this->nestedTransactionsCount = 0; - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\InvalidQueryException - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - $resultResource = $this->resource->query($sql); - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - if ($resultResource === false) { - $errorInfo = $this->resource->errorInfo(); - throw new Exception\InvalidQueryException($errorInfo[2]); - } - - $result = $this->driver->createResult($resultResource, $sql); - - return $result; - } - - /** - * Prepare - * - * @param string $sql - * @return Statement - */ - public function prepare($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - $statement = $this->driver->createStatement($sql); - - return $statement; - } - - /** - * {@inheritDoc} - * - * @param string $name - * @return string|null|false - */ - public function getLastGeneratedValue($name = null) - { - if ($name === null - && ($this->driverName == 'pgsql' || $this->driverName == 'firebird')) { - return; - } - - try { - return $this->resource->lastInsertId($name); - } catch (\Exception $e) { - // do nothing - } - - return false; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php deleted file mode 100644 index e913ee90..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php +++ /dev/null @@ -1,76 +0,0 @@ -getSql(); - if ($sql == '' || stripos($sql, 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; - $countStmt->prepare($countSql); - $result = $countStmt->execute(); - $countRow = $result->getResource()->fetch(\PDO::FETCH_ASSOC); - unset($statement, $result); - return $countRow['count']; - } - - /** - * @param $sql - * @return null|int - */ - public function getCountForSql($sql) - { - if (stripos($sql, 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as count FROM (' . $sql . ')'; - /** @var $pdo \PDO */ - $pdo = $this->driver->getConnection()->getResource(); - $result = $pdo->query($countSql); - $countRow = $result->fetch(\PDO::FETCH_ASSOC); - return $countRow['count']; - } - - /** - * @param $context - * @return \Closure - */ - public function getRowCountClosure($context) - { - return function () use ($context) { - return ($context instanceof Pdo\Statement) - ? $this->getCountForStatement($context) - : $this->getCountForSql($context); - }; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php deleted file mode 100644 index deb0ba3c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php +++ /dev/null @@ -1,76 +0,0 @@ -getSql(); - if ($sql == '' || stripos($sql, 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; - $countStmt->prepare($countSql); - $result = $countStmt->execute(); - $countRow = $result->getResource()->fetch(\PDO::FETCH_ASSOC); - unset($statement, $result); - return $countRow['count']; - } - - /** - * @param $sql - * @return null|int - */ - public function getCountForSql($sql) - { - if (stripos($sql, 'select') === false) { - return; - } - $countSql = 'SELECT COUNT(*) as count FROM (' . $sql . ')'; - /** @var $pdo \PDO */ - $pdo = $this->driver->getConnection()->getResource(); - $result = $pdo->query($countSql); - $countRow = $result->fetch(\PDO::FETCH_ASSOC); - return $countRow['count']; - } - - /** - * @param $context - * @return \Closure - */ - public function getRowCountClosure($context) - { - return function () use ($context) { - return ($context instanceof Pdo\Statement) - ? $this->getCountForStatement($context) - : $this->getCountForSql($context); - }; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php deleted file mode 100644 index daf4075c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php +++ /dev/null @@ -1,331 +0,0 @@ -registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - if (is_array($features)) { - foreach ($features as $name => $feature) { - $this->addFeature($name, $feature); - } - } elseif ($features instanceof AbstractFeature) { - $this->addFeature($features->getName(), $features); - } elseif ($features === self::FEATURES_DEFAULT) { - $this->setupDefaultFeatures(); - } - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Register connection - * - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); - return $this; - } - - /** - * Register statement prototype - * - * @param Statement $statementPrototype - */ - public function registerStatementPrototype(Statement $statementPrototype) - { - $this->statementPrototype = $statementPrototype; - $this->statementPrototype->setDriver($this); - } - - /** - * Register result prototype - * - * @param Result $resultPrototype - */ - public function registerResultPrototype(Result $resultPrototype) - { - $this->resultPrototype = $resultPrototype; - } - - /** - * Add feature - * - * @param string $name - * @param AbstractFeature $feature - * @return self Provides a fluent interface - */ - public function addFeature($name, $feature) - { - if ($feature instanceof AbstractFeature) { - $name = $feature->getName(); // overwrite the name, just in case - $feature->setDriver($this); - } - $this->features[$name] = $feature; - return $this; - } - - /** - * Setup the default features for Pdo - * - * @return self Provides a fluent interface - */ - public function setupDefaultFeatures() - { - $driverName = $this->connection->getDriverName(); - if ($driverName == 'sqlite') { - $this->addFeature(null, new Feature\SqliteRowCounter); - } elseif ($driverName == 'oci') { - $this->addFeature(null, new Feature\OracleRowCounter); - } - return $this; - } - - /** - * Get feature - * - * @param $name - * @return AbstractFeature|false - */ - public function getFeature($name) - { - if (isset($this->features[$name])) { - return $this->features[$name]; - } - return false; - } - - /** - * Get database platform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - $name = $this->getConnection()->getDriverName(); - if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { - switch ($name) { - case 'pgsql': - return 'Postgresql'; - case 'oci': - return 'Oracle'; - case 'dblib': - case 'sqlsrv': - return 'SqlServer'; - default: - return ucfirst($name); - } - } else { - switch ($name) { - case 'sqlite': - return 'SQLite'; - case 'mysql': - return 'MySQL'; - case 'pgsql': - return 'PostgreSQL'; - case 'oci': - return 'Oracle'; - case 'dblib': - case 'sqlsrv': - return 'SQLServer'; - default: - return ucfirst($name); - } - } - } - - /** - * Check environment - */ - public function checkEnvironment() - { - if (! extension_loaded('PDO')) { - throw new Exception\RuntimeException( - 'The PDO extension is required for this adapter but the extension is not loaded' - ); - } - } - - /** - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * @param string|PDOStatement $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - $statement = clone $this->statementPrototype; - if ($sqlOrResource instanceof PDOStatement) { - $statement->setResource($sqlOrResource); - } else { - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - $statement->initialize($this->connection->getResource()); - } - return $statement; - } - - /** - * @param resource $resource - * @param mixed $context - * @return Result - */ - public function createResult($resource, $context = null) - { - $result = clone $this->resultPrototype; - $rowCount = null; - - // special feature, sqlite PDO counter - if ($this->connection->getDriverName() == 'sqlite' - && ($sqliteRowCounter = $this->getFeature('SqliteRowCounter')) - && $resource->columnCount() > 0) { - $rowCount = $sqliteRowCounter->getRowCountClosure($context); - } - - // special feature, oracle PDO counter - if ($this->connection->getDriverName() == 'oci' - && ($oracleRowCounter = $this->getFeature('OracleRowCounter')) - && $resource->columnCount() > 0) { - $rowCount = $oracleRowCounter->getRowCountClosure($context); - } - - - $result->initialize($resource, $this->connection->getLastGeneratedValue(), $rowCount); - return $result; - } - - /** - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_NAMED; - } - - /** - * @param string $name - * @param string|null $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - if ($type === null && ! is_numeric($name) || $type == self::PARAMETERIZATION_NAMED) { - $name = ltrim($name, ':'); - // @see https://bugs.php.net/bug.php?id=43130 - if (preg_match('/[^a-zA-Z0-9_]/', $name)) { - throw new Exception\RuntimeException(sprintf( - 'The PDO param %s contains invalid characters.' - . ' Only alphabetic characters, digits, and underscores (_)' - . ' are allowed.', - $name - )); - } - return ':' . $name; - } - - return '?'; - } - - /** - * @param string|null $name - * @return string|null|false - */ - public function getLastGeneratedValue($name = null) - { - return $this->connection->getLastGeneratedValue($name); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php deleted file mode 100644 index ec4cdc65..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php +++ /dev/null @@ -1,254 +0,0 @@ -resource = $resource; - $this->generatedValue = $generatedValue; - $this->rowCount = $rowCount; - - return $this; - } - - /** - * @return null - */ - public function buffer() - { - return; - } - - /** - * @return bool|null - */ - public function isBuffered() - { - return false; - } - - /** - * @param int $fetchMode - * @throws Exception\InvalidArgumentException on invalid fetch mode - */ - public function setFetchMode($fetchMode) - { - if ($fetchMode < 1 || $fetchMode > 10) { - throw new Exception\InvalidArgumentException( - 'The fetch mode must be one of the PDO::FETCH_* constants.' - ); - } - - $this->fetchMode = (int) $fetchMode; - } - - /** - * @return int - */ - public function getFetchMode() - { - return $this->fetchMode; - } - - /** - * Get resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Get the data - * @return array - */ - public function current() - { - if ($this->currentComplete) { - return $this->currentData; - } - - $this->currentData = $this->resource->fetch($this->fetchMode); - $this->currentComplete = true; - return $this->currentData; - } - - /** - * Next - * - * @return mixed - */ - public function next() - { - $this->currentData = $this->resource->fetch($this->fetchMode); - $this->currentComplete = true; - $this->position++; - return $this->currentData; - } - - /** - * Key - * - * @return mixed - */ - public function key() - { - return $this->position; - } - - /** - * @throws Exception\RuntimeException - * @return void - */ - public function rewind() - { - if ($this->statementMode == self::STATEMENT_MODE_FORWARD && $this->position > 0) { - throw new Exception\RuntimeException( - 'This result is a forward only result set, calling rewind() after moving forward is not supported' - ); - } - $this->currentData = $this->resource->fetch($this->fetchMode); - $this->currentComplete = true; - $this->position = 0; - } - - /** - * Valid - * - * @return bool - */ - public function valid() - { - return ($this->currentData !== false); - } - - /** - * Count - * - * @return int - */ - public function count() - { - if (is_int($this->rowCount)) { - return $this->rowCount; - } - if ($this->rowCount instanceof \Closure) { - $this->rowCount = (int) call_user_func($this->rowCount); - } else { - $this->rowCount = (int) $this->resource->rowCount(); - } - return $this->rowCount; - } - - /** - * @return int - */ - public function getFieldCount() - { - return $this->resource->columnCount(); - } - - /** - * Is query result - * - * @return bool - */ - public function isQueryResult() - { - return ($this->resource->columnCount() > 0); - } - - /** - * Get affected rows - * - * @return int - */ - public function getAffectedRows() - { - return $this->resource->rowCount(); - } - - /** - * @return mixed|null - */ - public function getGeneratedValue() - { - return $this->generatedValue; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php deleted file mode 100644 index 97c9e191..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php +++ /dev/null @@ -1,310 +0,0 @@ -driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Initialize - * - * @param \PDO $connectionResource - * @return self Provides a fluent interface - */ - public function initialize(\PDO $connectionResource) - { - $this->pdo = $connectionResource; - return $this; - } - - /** - * Set resource - * - * @param \PDOStatement $pdoStatement - * @return self Provides a fluent interface - */ - public function setResource(\PDOStatement $pdoStatement) - { - $this->resource = $pdoStatement; - return $this; - } - - /** - * Get resource - * - * @return mixed - */ - public function getResource() - { - return $this->resource; - } - - /** - * Set sql - * - * @param string $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Get sql - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * @return ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * @param string $sql - * @throws Exception\RuntimeException - */ - public function prepare($sql = null) - { - if ($this->isPrepared) { - throw new Exception\RuntimeException('This statement has been prepared already'); - } - - if ($sql === null) { - $sql = $this->sql; - } - - $this->resource = $this->pdo->prepare($sql); - - if ($this->resource === false) { - $error = $this->pdo->errorInfo(); - throw new Exception\RuntimeException($error[2]); - } - - $this->isPrepared = true; - } - - /** - * @return bool - */ - public function isPrepared() - { - return $this->isPrepared; - } - - /** - * @param null|array|ParameterContainer $parameters - * @throws Exception\InvalidQueryException - * @return Result - */ - public function execute($parameters = null) - { - if (! $this->isPrepared) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - - if ($this->parameterContainer->count() > 0) { - $this->bindParametersFromContainer(); - } - /** END Standard ParameterContainer Merging Block */ - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - try { - $this->resource->execute(); - } catch (\PDOException $e) { - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - throw new Exception\InvalidQueryException( - 'Statement could not be executed (' . implode(' - ', $this->resource->errorInfo()) . ')', - null, - $e - ); - } - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - $result = $this->driver->createResult($this->resource, $this); - return $result; - } - - /** - * Bind parameters from container - */ - protected function bindParametersFromContainer() - { - if ($this->parametersBound) { - return; - } - - $parameters = $this->parameterContainer->getNamedArray(); - foreach ($parameters as $name => &$value) { - if (is_bool($value)) { - $type = \PDO::PARAM_BOOL; - } elseif (is_int($value)) { - $type = \PDO::PARAM_INT; - } else { - $type = \PDO::PARAM_STR; - } - if ($this->parameterContainer->offsetHasErrata($name)) { - switch ($this->parameterContainer->offsetGetErrata($name)) { - case ParameterContainer::TYPE_INTEGER: - $type = \PDO::PARAM_INT; - break; - case ParameterContainer::TYPE_NULL: - $type = \PDO::PARAM_NULL; - break; - case ParameterContainer::TYPE_LOB: - $type = \PDO::PARAM_LOB; - break; - } - } - - // parameter is named or positional, value is reference - $parameter = is_int($name) ? ($name + 1) : $this->driver->formatParameterName($name); - $this->resource->bindParam($parameter, $value, $type); - } - } - - /** - * Perform a deep clone - * @return Statement A cloned statement - */ - public function __clone() - { - $this->isPrepared = false; - $this->parametersBound = false; - $this->resource = null; - if ($this->parameterContainer) { - $this->parameterContainer = clone $this->parameterContainer; - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php deleted file mode 100644 index a13321a9..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php +++ /dev/null @@ -1,313 +0,0 @@ -setConnectionParameters($connectionInfo); - } elseif (is_resource($connectionInfo)) { - $this->setResource($connectionInfo); - } - } - - /** - * Set resource - * - * @param resource $resource - * @return self Provides a fluent interface - */ - public function setResource($resource) - { - $this->resource = $resource; - - return $this; - } - - - /** - * Set driver - * - * @param Pgsql $driver - * @return self Provides a fluent interface - */ - public function setDriver(Pgsql $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * @param int|null $type - * @return self Provides a fluent interface - */ - public function setType($type) - { - $invalidConectionType = ($type !== PGSQL_CONNECT_FORCE_NEW); - - // Compatibility with PHP < 5.6 - if ($invalidConectionType && defined('PGSQL_CONNECT_ASYNC')) { - $invalidConectionType = ($type !== PGSQL_CONNECT_ASYNC); - } - - if ($invalidConectionType) { - throw new Exception\InvalidArgumentException( - 'Connection type is not valid. (See: http://php.net/manual/en/function.pg-connect.php)' - ); - } - $this->type = $type; - return $this; - } - - /** - * {@inheritDoc} - * - * @return null|string - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $result = pg_query($this->resource, 'SELECT CURRENT_SCHEMA AS "currentschema"'); - if ($result == false) { - return; - } - - return pg_fetch_result($result, 0, 'currentschema'); - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException on failure - */ - public function connect() - { - if (is_resource($this->resource)) { - return $this; - } - - $connection = $this->getConnectionString(); - set_error_handler(function ($number, $string) { - throw new Exception\RuntimeException( - __METHOD__ . ': Unable to connect to database', - null, - new Exception\ErrorException($string, $number) - ); - }); - $this->resource = pg_connect($connection); - restore_error_handler(); - - if ($this->resource === false) { - throw new Exception\RuntimeException(sprintf( - '%s: Unable to connect to database', - __METHOD__ - )); - } - - $p = $this->connectionParameters; - - if (! empty($p['charset'])) { - if (-1 === pg_set_client_encoding($this->resource, $p['charset'])) { - throw new Exception\RuntimeException(sprintf( - "%s: Unable to set client encoding '%s'", - __METHOD__, - $p['charset'] - )); - } - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return (is_resource($this->resource)); - } - - /** - * {@inheritDoc} - */ - public function disconnect() - { - pg_close($this->resource); - return $this; - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if ($this->inTransaction()) { - throw new Exception\RuntimeException('Nested transactions are not supported'); - } - - if (! $this->isConnected()) { - $this->connect(); - } - - pg_query($this->resource, 'BEGIN'); - $this->inTransaction = true; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if (! $this->inTransaction()) { - return; // We ignore attempts to commit non-existing transaction - } - - pg_query($this->resource, 'COMMIT'); - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function rollback() - { - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback'); - } - - if (! $this->inTransaction()) { - throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback'); - } - - pg_query($this->resource, 'ROLLBACK'); - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\InvalidQueryException - * @return resource|\Zend\Db\ResultSet\ResultSetInterface - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - $resultResource = pg_query($this->resource, $sql); - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - // if the returnValue is something other than a pg result resource, bypass wrapping it - if ($resultResource === false) { - throw new Exception\InvalidQueryException(pg_errormessage()); - } - - $resultPrototype = $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); - - return $resultPrototype; - } - - /** - * {@inheritDoc} - * - * @return string - */ - public function getLastGeneratedValue($name = null) - { - if ($name === null) { - return; - } - $result = pg_query( - $this->resource, - 'SELECT CURRVAL(\'' . str_replace('\'', '\\\'', $name) . '\') as "currval"' - ); - - return pg_fetch_result($result, 0, 'currval'); - } - - /** - * Get Connection String - * - * @return string - */ - private function getConnectionString() - { - // localize - $p = $this->connectionParameters; - - // given a list of key names, test for existence in $p - $findParameterValue = function (array $names) use ($p) { - foreach ($names as $name) { - if (isset($p[$name])) { - return $p[$name]; - } - } - return; - }; - - $connectionParameters = [ - 'host' => $findParameterValue(['hostname', 'host']), - 'user' => $findParameterValue(['username', 'user']), - 'password' => $findParameterValue(['password', 'passwd', 'pw']), - 'dbname' => $findParameterValue(['database', 'dbname', 'db', 'schema']), - 'port' => isset($p['port']) ? (int) $p['port'] : null, - 'socket' => isset($p['socket']) ? $p['socket'] : null, - ]; - - return urldecode(http_build_query(array_filter($connectionParameters), null, ' ')); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php deleted file mode 100644 index b99b641e..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php +++ /dev/null @@ -1,237 +0,0 @@ - false - ]; - - /** - * Constructor - * - * @param array|Connection|resource $connection - * @param null|Statement $statementPrototype - * @param null|Result $resultPrototype - * @param array $options - */ - public function __construct( - $connection, - Statement $statementPrototype = null, - Result $resultPrototype = null, - $options = null - ) { - if (! $connection instanceof Connection) { - $connection = new Connection($connection); - } - - $this->registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Register connection - * - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); - return $this; - } - - /** - * Register statement prototype - * - * @param Statement $statement - * @return self Provides a fluent interface - */ - public function registerStatementPrototype(Statement $statement) - { - $this->statementPrototype = $statement; - $this->statementPrototype->setDriver($this); // needs access to driver to createResult() - return $this; - } - - /** - * Register result prototype - * - * @param Result $result - * @return self Provides a fluent interface - */ - public function registerResultPrototype(Result $result) - { - $this->resultPrototype = $result; - return $this; - } - - /** - * Get database platform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { - return 'Postgresql'; - } - - return 'PostgreSQL'; - } - - /** - * Check environment - * - * @throws Exception\RuntimeException - * @return bool - */ - public function checkEnvironment() - { - if (! extension_loaded('pgsql')) { - throw new Exception\RuntimeException( - 'The PostgreSQL (pgsql) extension is required for this adapter but the extension is not loaded' - ); - } - } - - /** - * Get connection - * - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Create statement - * - * @param string|null $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - $statement = clone $this->statementPrototype; - - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } - - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - - $statement->initialize($this->connection->getResource()); - return $statement; - } - - /** - * Create result - * - * @param resource $resource - * @return Result - */ - public function createResult($resource) - { - $result = clone $this->resultPrototype; - $result->initialize($resource, $this->connection->getLastGeneratedValue()); - return $result; - } - - /** - * Get prepare Type - * - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_POSITIONAL; - } - - /** - * Format parameter name - * - * @param string $name - * @param mixed $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - return '$#'; - } - - /** - * Get last generated value - * - * @param string $name - * @return mixed - */ - public function getLastGeneratedValue($name = null) - { - return $this->connection->getLastGeneratedValue($name); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php deleted file mode 100644 index 918f5c68..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php +++ /dev/null @@ -1,192 +0,0 @@ -resource = $resource; - $this->count = pg_num_rows($this->resource); - $this->generatedValue = $generatedValue; - } - - /** - * Current - * - * @return array|bool|mixed - */ - public function current() - { - if ($this->count === 0) { - return false; - } - return pg_fetch_assoc($this->resource, $this->position); - } - - /** - * Next - * - * @return void - */ - public function next() - { - $this->position++; - } - - /** - * Key - * - * @return int|mixed - */ - public function key() - { - return $this->position; - } - - /** - * Valid - * - * @return bool - */ - public function valid() - { - return ($this->position < $this->count); - } - - /** - * Rewind - * - * @return void - */ - public function rewind() - { - $this->position = 0; - } - - /** - * Buffer - * - * @return null - */ - public function buffer() - { - return; - } - - /** - * Is buffered - * - * @return false - */ - public function isBuffered() - { - return false; - } - - /** - * Is query result - * - * @return bool - */ - public function isQueryResult() - { - return (pg_num_fields($this->resource) > 0); - } - - /** - * Get affected rows - * - * @return int - */ - public function getAffectedRows() - { - return pg_affected_rows($this->resource); - } - - /** - * Get generated value - * - * @return mixed|null - */ - public function getGeneratedValue() - { - return $this->generatedValue; - } - - /** - * Get resource - */ - public function getResource() - { - // TODO: Implement getResource() method. - } - - /** - * Count - * - * (PHP 5 >= 5.1.0)
- * Count elements of an object - * @link http://php.net/manual/en/countable.count.php - * @return int The custom count as an integer. - *

- *

- * The return value is cast to an integer. - */ - public function count() - { - return $this->count; - } - - /** - * Get field count - * - * @return int - */ - public function getFieldCount() - { - return pg_num_fields($this->resource); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php deleted file mode 100644 index c7e84506..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php +++ /dev/null @@ -1,242 +0,0 @@ -driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Initialize - * - * @param resource $pgsql - * @return void - * @throws Exception\RuntimeException for invalid or missing postgresql connection - */ - public function initialize($pgsql) - { - if (! is_resource($pgsql) || get_resource_type($pgsql) !== 'pgsql link') { - throw new Exception\RuntimeException(sprintf( - '%s: Invalid or missing postgresql connection; received "%s"', - __METHOD__, - get_resource_type($pgsql) - )); - } - $this->pgsql = $pgsql; - } - - /** - * Get resource - * - * @return resource - */ - public function getResource() - { - // TODO: Implement getResource() method. - } - - /** - * Set sql - * - * @param string $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Get sql - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Set parameter container - * - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * Get parameter container - * - * @return ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * Prepare - * - * @param string $sql - */ - public function prepare($sql = null) - { - $sql = ($sql) ?: $this->sql; - - $pCount = 1; - $sql = preg_replace_callback( - '#\$\##', - function () use (&$pCount) { - return '$' . $pCount++; - }, - $sql - ); - - $this->sql = $sql; - $this->statementName = 'statement' . ++static::$statementIndex; - $this->resource = pg_prepare($this->pgsql, $this->statementName, $sql); - } - - /** - * Is prepared - * - * @return bool - */ - public function isPrepared() - { - return isset($this->resource); - } - - /** - * Execute - * - * @param null|array|ParameterContainer $parameters - * @throws Exception\InvalidQueryException - * @return Result - */ - public function execute($parameters = null) - { - if (! $this->isPrepared()) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - - if ($this->parameterContainer->count() > 0) { - $parameters = $this->parameterContainer->getPositionalArray(); - } - /** END Standard ParameterContainer Merging Block */ - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - $resultResource = pg_execute($this->pgsql, $this->statementName, (array) $parameters); - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - if ($resultResource === false) { - throw new Exception\InvalidQueryException(pg_last_error()); - } - - $result = $this->driver->createResult($resultResource); - return $result; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php deleted file mode 100644 index 486b40f1..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -setConnectionParameters($connectionInfo); - } elseif (is_resource($connectionInfo)) { - $this->setResource($connectionInfo); - } else { - throw new Exception\InvalidArgumentException('$connection must be an array of parameters or a resource'); - } - } - - /** - * Set driver - * - * @param Sqlsrv $driver - * @return self Provides a fluent interface - */ - public function setDriver(Sqlsrv $driver) - { - $this->driver = $driver; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function getCurrentSchema() - { - if (! $this->isConnected()) { - $this->connect(); - } - - $result = sqlsrv_query($this->resource, 'SELECT SCHEMA_NAME()'); - $r = sqlsrv_fetch_array($result); - - return $r[0]; - } - - /** - * Set resource - * - * @param resource $resource - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setResource($resource) - { - if (get_resource_type($resource) !== 'SQL Server Connection') { - throw new Exception\InvalidArgumentException('Resource provided was not of type SQL Server Connection'); - } - $this->resource = $resource; - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function connect() - { - if ($this->resource) { - return $this; - } - - $serverName = '.'; - $params = [ - 'ReturnDatesAsStrings' => true - ]; - foreach ($this->connectionParameters as $key => $value) { - switch (strtolower($key)) { - case 'hostname': - case 'servername': - $serverName = (string) $value; - break; - case 'username': - case 'uid': - $params['UID'] = (string) $value; - break; - case 'password': - case 'pwd': - $params['PWD'] = (string) $value; - break; - case 'database': - case 'dbname': - $params['Database'] = (string) $value; - break; - case 'charset': - $params['CharacterSet'] = (string) $value; - break; - case 'driver_options': - case 'options': - $params = array_merge($params, (array) $value); - break; - } - } - - $this->resource = sqlsrv_connect($serverName, $params); - - if (! $this->resource) { - throw new Exception\RuntimeException( - 'Connect Error', - null, - new ErrorException(sqlsrv_errors()) - ); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function isConnected() - { - return (is_resource($this->resource)); - } - - /** - * {@inheritDoc} - */ - public function disconnect() - { - sqlsrv_close($this->resource); - $this->resource = null; - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - if (! $this->isConnected()) { - $this->connect(); - } - - if (sqlsrv_begin_transaction($this->resource) === false) { - throw new Exception\RuntimeException( - new ErrorException(sqlsrv_errors()) - ); - } - - $this->inTransaction = true; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function commit() - { - // http://msdn.microsoft.com/en-us/library/cc296194.aspx - - if (! $this->isConnected()) { - $this->connect(); - } - - sqlsrv_commit($this->resource); - - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function rollback() - { - // http://msdn.microsoft.com/en-us/library/cc296176.aspx - - if (! $this->isConnected()) { - throw new Exception\RuntimeException('Must be connected before you can rollback.'); - } - - sqlsrv_rollback($this->resource); - $this->inTransaction = false; - - return $this; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function execute($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - if (! $this->driver instanceof Sqlsrv) { - throw new Exception\RuntimeException('Connection is missing an instance of Sqlsrv'); - } - - if ($this->profiler) { - $this->profiler->profilerStart($sql); - } - - $returnValue = sqlsrv_query($this->resource, $sql); - - if ($this->profiler) { - $this->profiler->profilerFinish($sql); - } - - // if the returnValue is something other than a Sqlsrv_result, bypass wrapping it - if ($returnValue === false) { - $errors = sqlsrv_errors(); - // ignore general warnings - if ($errors[0]['SQLSTATE'] != '01000') { - throw new Exception\RuntimeException( - 'An exception occurred while trying to execute the provided $sql', - null, - new ErrorException($errors) - ); - } - } - - $result = $this->driver->createResult($returnValue); - - return $result; - } - - /** - * Prepare - * - * @param string $sql - * @return string - */ - public function prepare($sql) - { - if (! $this->isConnected()) { - $this->connect(); - } - - $statement = $this->driver->createStatement($sql); - - return $statement; - } - - /** - * {@inheritDoc} - * - * @return mixed - */ - public function getLastGeneratedValue($name = null) - { - if (! $this->resource) { - $this->connect(); - } - $sql = 'SELECT @@IDENTITY as Current_Identity'; - $result = sqlsrv_query($this->resource, $sql); - $row = sqlsrv_fetch_array($result); - - return $row['Current_Identity']; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php deleted file mode 100644 index afc31427..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php +++ /dev/null @@ -1,32 +0,0 @@ -errors = ($errors === false) ? sqlsrv_errors() : $errors; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php deleted file mode 100644 index b260fca6..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -resource = $resource; - $this->generatedValue = $generatedValue; - return $this; - } - - /** - * @return null - */ - public function buffer() - { - return; - } - - /** - * @return bool - */ - public function isBuffered() - { - return false; - } - - /** - * Get resource - * - * @return resource - */ - public function getResource() - { - return $this->resource; - } - - /** - * Current - * - * @return mixed - */ - public function current() - { - if ($this->currentComplete) { - return $this->currentData; - } - - $this->load(); - return $this->currentData; - } - - /** - * Next - * - * @return bool - */ - public function next() - { - $this->load(); - return true; - } - - /** - * Load - * - * @param int $row - * @return mixed - */ - protected function load($row = SQLSRV_SCROLL_NEXT) - { - $this->currentData = sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_ASSOC, $row); - $this->currentComplete = true; - $this->position++; - return $this->currentData; - } - - /** - * Key - * - * @return mixed - */ - public function key() - { - return $this->position; - } - - /** - * Rewind - * - * @return bool - */ - public function rewind() - { - $this->position = 0; - $this->load(SQLSRV_SCROLL_FIRST); - return true; - } - - /** - * Valid - * - * @return bool - */ - public function valid() - { - if ($this->currentComplete && $this->currentData) { - return true; - } - - return $this->load(); - } - - /** - * Count - * - * @return int - */ - public function count() - { - return sqlsrv_num_rows($this->resource); - } - - /** - * @return bool|int - */ - public function getFieldCount() - { - return sqlsrv_num_fields($this->resource); - } - - /** - * Is query result - * - * @return bool - */ - public function isQueryResult() - { - if (is_bool($this->resource)) { - return false; - } - return (sqlsrv_num_fields($this->resource) > 0); - } - - /** - * Get affected rows - * - * @return int - */ - public function getAffectedRows() - { - return sqlsrv_rows_affected($this->resource); - } - - /** - * @return mixed|null - */ - public function getGeneratedValue() - { - return $this->generatedValue; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php deleted file mode 100644 index 9a712905..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php +++ /dev/null @@ -1,215 +0,0 @@ -registerConnection($connection); - $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); - $this->registerResultPrototype(($resultPrototype) ?: new Result()); - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - if ($this->connection instanceof Profiler\ProfilerAwareInterface) { - $this->connection->setProfiler($profiler); - } - if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { - $this->statementPrototype->setProfiler($profiler); - } - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Register connection - * - * @param Connection $connection - * @return self Provides a fluent interface - */ - public function registerConnection(Connection $connection) - { - $this->connection = $connection; - $this->connection->setDriver($this); - return $this; - } - - /** - * Register statement prototype - * - * @param Statement $statementPrototype - * @return self Provides a fluent interface - */ - public function registerStatementPrototype(Statement $statementPrototype) - { - $this->statementPrototype = $statementPrototype; - $this->statementPrototype->setDriver($this); - return $this; - } - - /** - * Register result prototype - * - * @param Result $resultPrototype - * @return self Provides a fluent interface - */ - public function registerResultPrototype(Result $resultPrototype) - { - $this->resultPrototype = $resultPrototype; - return $this; - } - - /** - * Get database paltform name - * - * @param string $nameFormat - * @return string - */ - public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) - { - if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { - return 'SqlServer'; - } - - return 'SQLServer'; - } - - /** - * Check environment - * - * @throws Exception\RuntimeException - * @return void - */ - public function checkEnvironment() - { - if (! extension_loaded('sqlsrv')) { - throw new Exception\RuntimeException( - 'The Sqlsrv extension is required for this adapter but the extension is not loaded' - ); - } - } - - /** - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * @param string|resource $sqlOrResource - * @return Statement - */ - public function createStatement($sqlOrResource = null) - { - $statement = clone $this->statementPrototype; - if (is_resource($sqlOrResource)) { - $statement->initialize($sqlOrResource); - } else { - if (! $this->connection->isConnected()) { - $this->connection->connect(); - } - $statement->initialize($this->connection->getResource()); - if (is_string($sqlOrResource)) { - $statement->setSql($sqlOrResource); - } elseif ($sqlOrResource !== null) { - throw new Exception\InvalidArgumentException( - 'createStatement() only accepts an SQL string or a Sqlsrv resource' - ); - } - } - return $statement; - } - - /** - * @param resource $resource - * @return Result - */ - public function createResult($resource) - { - $result = clone $this->resultPrototype; - $result->initialize($resource, $this->connection->getLastGeneratedValue()); - return $result; - } - - /** - * @return string - */ - public function getPrepareType() - { - return self::PARAMETERIZATION_POSITIONAL; - } - - /** - * @param string $name - * @param mixed $type - * @return string - */ - public function formatParameterName($name, $type = null) - { - return '?'; - } - - /** - * @return mixed - */ - public function getLastGeneratedValue() - { - return $this->getConnection()->getLastGeneratedValue(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php deleted file mode 100644 index ffc922ac..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php +++ /dev/null @@ -1,318 +0,0 @@ -driver = $driver; - return $this; - } - - /** - * @param Profiler\ProfilerInterface $profiler - * @return self Provides a fluent interface - */ - public function setProfiler(Profiler\ProfilerInterface $profiler) - { - $this->profiler = $profiler; - return $this; - } - - /** - * @return null|Profiler\ProfilerInterface - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * - * One of two resource types will be provided here: - * a) "SQL Server Connection" when a prepared statement needs to still be produced - * b) "SQL Server Statement" when a prepared statement has been already produced - * (there will need to already be a bound param set if it applies to this query) - * - * @param resource $resource - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function initialize($resource) - { - $resourceType = get_resource_type($resource); - - if ($resourceType == 'SQL Server Connection') { - $this->sqlsrv = $resource; - } elseif ($resourceType == 'SQL Server Statement') { - $this->resource = $resource; - $this->isPrepared = true; - } else { - throw new Exception\InvalidArgumentException('Invalid resource provided to ' . __CLASS__); - } - - return $this; - } - - /** - * Set parameter container - * - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * @return ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } - - /** - * @param $resource - * @return self Provides a fluent interface - */ - public function setResource($resource) - { - $this->resource = $resource; - return $this; - } - - /** - * Get resource - * - * @return resource - */ - public function getResource() - { - return $this->resource; - } - - /** - * @param string $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * Get sql - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * @param string $sql - * @param array $options - * @return self Provides a fluent interface - * @throws Exception\RuntimeException - */ - public function prepare($sql = null, array $options = []) - { - if ($this->isPrepared) { - throw new Exception\RuntimeException('Already prepared'); - } - $sql = ($sql) ?: $this->sql; - $options = ($options) ?: $this->prepareOptions; - - $pRef = &$this->parameterReferences; - for ($position = 0, $count = substr_count($sql, '?'); $position < $count; $position++) { - if (! isset($this->prepareParams[$position])) { - $pRef[$position] = [&$this->parameterReferenceValues[$position], SQLSRV_PARAM_IN, null, null]; - } else { - $pRef[$position] = &$this->prepareParams[$position]; - } - } - - $this->resource = sqlsrv_prepare($this->sqlsrv, $sql, $pRef, $options); - - $this->isPrepared = true; - - return $this; - } - - /** - * @return bool - */ - public function isPrepared() - { - return $this->isPrepared; - } - - /** - * Execute - * - * @param null|array|ParameterContainer $parameters - * @throws Exception\RuntimeException - * @return Result - */ - public function execute($parameters = null) - { - /** END Standard ParameterContainer Merging Block */ - if (! $this->isPrepared) { - $this->prepare(); - } - - /** START Standard ParameterContainer Merging Block */ - if (! $this->parameterContainer instanceof ParameterContainer) { - if ($parameters instanceof ParameterContainer) { - $this->parameterContainer = $parameters; - $parameters = null; - } else { - $this->parameterContainer = new ParameterContainer(); - } - } - - if (is_array($parameters)) { - $this->parameterContainer->setFromArray($parameters); - } - - if ($this->parameterContainer->count() > 0) { - $this->bindParametersFromContainer(); - } - - if ($this->profiler) { - $this->profiler->profilerStart($this); - } - - $resultValue = sqlsrv_execute($this->resource); - - if ($this->profiler) { - $this->profiler->profilerFinish(); - } - - if ($resultValue === false) { - $errors = sqlsrv_errors(); - // ignore general warnings - if ($errors[0]['SQLSTATE'] != '01000') { - throw new Exception\RuntimeException($errors[0]['message']); - } - } - - $result = $this->driver->createResult($this->resource); - return $result; - } - - /** - * Bind parameters from container - * - */ - protected function bindParametersFromContainer() - { - $values = $this->parameterContainer->getPositionalArray(); - $position = 0; - foreach ($values as $value) { - $this->parameterReferences[$position++][0] = $value; - } - } - - /** - * @param array $prepareParams - */ - public function setPrepareParams(array $prepareParams) - { - $this->prepareParams = $prepareParams; - } - - /** - * @param array $prepareOptions - */ - public function setPrepareOptions(array $prepareOptions) - { - $this->prepareOptions = $prepareOptions; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php deleted file mode 100644 index cb4eea85..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php +++ /dev/null @@ -1,45 +0,0 @@ -parameters = $parameters; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php b/bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php deleted file mode 100644 index 3fbb486f..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php +++ /dev/null @@ -1,14 +0,0 @@ -setFromArray($data); - } - } - - /** - * Offset exists - * - * @param string $name - * @return bool - */ - public function offsetExists($name) - { - return (isset($this->data[$name])); - } - - /** - * Offset get - * - * @param string $name - * @return mixed - */ - public function offsetGet($name) - { - return (isset($this->data[$name])) ? $this->data[$name] : null; - } - - /** - * @param $name - * @param $from - */ - public function offsetSetReference($name, $from) - { - $this->data[$name] =& $this->data[$from]; - } - - /** - * Offset set - * - * @param string|int $name - * @param mixed $value - * @param mixed $errata - * @param mixed $maxLength - * @throws Exception\InvalidArgumentException - */ - public function offsetSet($name, $value, $errata = null, $maxLength = null) - { - $position = false; - - // if integer, get name for this position - if (is_int($name)) { - if (isset($this->positions[$name])) { - $position = $name; - $name = $this->positions[$name]; - } else { - $name = (string) $name; - } - } elseif (is_string($name)) { - // is a string: - $position = array_key_exists($name, $this->data); - } elseif ($name === null) { - $name = (string) count($this->data); - } else { - throw new Exception\InvalidArgumentException('Keys must be string, integer or null'); - } - - if ($position === false) { - $this->positions[] = $name; - } - - $this->data[$name] = $value; - - if ($errata) { - $this->offsetSetErrata($name, $errata); - } - - if ($maxLength) { - $this->offsetSetMaxLength($name, $maxLength); - } - } - - /** - * Offset unset - * - * @param string $name - * @return self Provides a fluent interface - */ - public function offsetUnset($name) - { - if (is_int($name) && isset($this->positions[$name])) { - $name = $this->positions[$name]; - } - unset($this->data[$name]); - return $this; - } - - /** - * Set from array - * - * @param array $data - * @return self Provides a fluent interface - */ - public function setFromArray(array $data) - { - foreach ($data as $n => $v) { - $this->offsetSet($n, $v); - } - return $this; - } - - /** - * Offset set max length - * - * @param string|int $name - * @param mixed $maxLength - */ - public function offsetSetMaxLength($name, $maxLength) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - $this->maxLength[$name] = $maxLength; - } - - /** - * Offset get max length - * - * @param string|int $name - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function offsetGetMaxLength($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - if (! array_key_exists($name, $this->data)) { - throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); - } - return $this->maxLength[$name]; - } - - /** - * Offset has max length - * - * @param string|int $name - * @return bool - */ - public function offsetHasMaxLength($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - return (isset($this->maxLength[$name])); - } - - /** - * Offset unset max length - * - * @param string|int $name - * @throws Exception\InvalidArgumentException - */ - public function offsetUnsetMaxLength($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - if (! array_key_exists($name, $this->maxLength)) { - throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); - } - $this->maxLength[$name] = null; - } - - /** - * Get max length iterator - * - * @return \ArrayIterator - */ - public function getMaxLengthIterator() - { - return new \ArrayIterator($this->maxLength); - } - - /** - * Offset set errata - * - * @param string|int $name - * @param mixed $errata - */ - public function offsetSetErrata($name, $errata) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - $this->errata[$name] = $errata; - } - - /** - * Offset get errata - * - * @param string|int $name - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function offsetGetErrata($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - if (! array_key_exists($name, $this->data)) { - throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); - } - return $this->errata[$name]; - } - - /** - * Offset has errata - * - * @param string|int $name - * @return bool - */ - public function offsetHasErrata($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - return (isset($this->errata[$name])); - } - - /** - * Offset unset errata - * - * @param string|int $name - * @throws Exception\InvalidArgumentException - */ - public function offsetUnsetErrata($name) - { - if (is_int($name)) { - $name = $this->positions[$name]; - } - if (! array_key_exists($name, $this->errata)) { - throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); - } - $this->errata[$name] = null; - } - - /** - * Get errata iterator - * - * @return \ArrayIterator - */ - public function getErrataIterator() - { - return new \ArrayIterator($this->errata); - } - - /** - * getNamedArray - * - * @return array - */ - public function getNamedArray() - { - return $this->data; - } - - /** - * getNamedArray - * - * @return array - */ - public function getPositionalArray() - { - return array_values($this->data); - } - - /** - * count - * - * @return int - */ - public function count() - { - return count($this->data); - } - - /** - * Current - * - * @return mixed - */ - public function current() - { - return current($this->data); - } - - /** - * Next - * - * @return mixed - */ - public function next() - { - return next($this->data); - } - - /** - * Key - * - * @return mixed - */ - public function key() - { - return key($this->data); - } - - /** - * Valid - * - * @return bool - */ - public function valid() - { - return (current($this->data) !== false); - } - - /** - * Rewind - */ - public function rewind() - { - reset($this->data); - } - - /** - * @param array|ParameterContainer $parameters - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function merge($parameters) - { - if (! is_array($parameters) && ! $parameters instanceof ParameterContainer) { - throw new Exception\InvalidArgumentException( - '$parameters must be an array or an instance of ParameterContainer' - ); - } - - if (count($parameters) == 0) { - return $this; - } - - if ($parameters instanceof ParameterContainer) { - $parameters = $parameters->getNamedArray(); - } - - foreach ($parameters as $key => $value) { - if (is_int($key)) { - $key = null; - } - $this->offsetSet($key, $value); - } - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php deleted file mode 100644 index 42b88575..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php +++ /dev/null @@ -1,142 +0,0 @@ -quoteIdentifiers) { - return $identifier; - } - - $safeWordsInt = ['*' => true, ' ' => true, '.' => true, 'as' => true]; - - foreach ($safeWords as $sWord) { - $safeWordsInt[strtolower($sWord)] = true; - } - - $parts = preg_split( - $this->quoteIdentifierFragmentPattern, - $identifier, - -1, - PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY - ); - - $identifier = ''; - - foreach ($parts as $part) { - $identifier .= isset($safeWordsInt[strtolower($part)]) - ? $part - : $this->quoteIdentifier[0] - . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) - . $this->quoteIdentifier[1]; - } - - return $identifier; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifier($identifier) - { - if (! $this->quoteIdentifiers) { - return $identifier; - } - - return $this->quoteIdentifier[0] - . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $identifier) - . $this->quoteIdentifier[1]; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - return '"' . implode('"."', (array) str_replace('"', '\\"', $identifierChain)) . '"'; - } - - /** - * {@inheritDoc} - */ - public function getQuoteIdentifierSymbol() - { - return $this->quoteIdentifier[0]; - } - - /** - * {@inheritDoc} - */ - public function getQuoteValueSymbol() - { - return '\''; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - trigger_error( - 'Attempting to quote a value in ' . get_class($this) . - ' without extension/driver support can introduce security vulnerabilities in a production environment' - ); - return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; - } - - /** - * {@inheritDoc} - */ - public function quoteValueList($valueList) - { - return implode(', ', array_map([$this, 'quoteValue'], (array) $valueList)); - } - - /** - * {@inheritDoc} - */ - public function getIdentifierSeparator() - { - return '.'; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php deleted file mode 100644 index 7b22b0fa..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php +++ /dev/null @@ -1,125 +0,0 @@ -quoteIdentifiers = false; - } - - if (isset($options['identifier_separator'])) { - $this->identifierSeparator = $options['identifier_separator']; - } - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'IBM DB2'; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierInFragment($identifier, array $safeWords = []) - { - if (! $this->quoteIdentifiers) { - return $identifier; - } - $safeWordsInt = ['*' => true, ' ' => true, '.' => true, 'as' => true]; - foreach ($safeWords as $sWord) { - $safeWordsInt[strtolower($sWord)] = true; - } - $parts = preg_split( - '/([^0-9,a-z,A-Z$#_:])/i', - $identifier, - -1, - PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY - ); - $identifier = ''; - foreach ($parts as $part) { - $identifier .= isset($safeWordsInt[strtolower($part)]) - ? $part - : $this->quoteIdentifier[0] - . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) - . $this->quoteIdentifier[1]; - } - return $identifier; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - if ($this->quoteIdentifiers === false) { - if (is_array($identifierChain)) { - return implode($this->identifierSeparator, $identifierChain); - } else { - return $identifierChain; - } - } - $identifierChain = str_replace('"', '\\"', $identifierChain); - if (is_array($identifierChain)) { - $identifierChain = implode('"' . $this->identifierSeparator . '"', $identifierChain); - } - return '"' . $identifierChain . '"'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - if (function_exists('db2_escape_string')) { - return '\'' . db2_escape_string($value) . '\''; - } - trigger_error( - 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' - . 'can introduce security vulnerabilities in a production environment.' - ); - return '\'' . str_replace("'", "''", $value) . '\''; - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - if (function_exists('db2_escape_string')) { - return '\'' . db2_escape_string($value) . '\''; - } - return '\'' . str_replace("'", "''", $value) . '\''; - } - - /** - * {@inheritDoc} - */ - public function getIdentifierSeparator() - { - return $this->identifierSeparator; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Mysql.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Mysql.php deleted file mode 100644 index 3aae7bbc..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Mysql.php +++ /dev/null @@ -1,122 +0,0 @@ -setDriver($driver); - } - } - - /** - * @param \Zend\Db\Adapter\Driver\Mysqli\Mysqli|\Zend\Db\Adapter\Driver\Pdo\Pdo|\mysqli|\PDO $driver - * @return self Provides a fluent interface - * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException - */ - public function setDriver($driver) - { - // handle Zend\Db drivers - if ($driver instanceof Mysqli\Mysqli - || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Mysql') - || ($driver instanceof \mysqli) - || ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql') - ) { - $this->resource = $driver; - return $this; - } - - throw new Exception\InvalidArgumentException( - '$driver must be a Mysqli or Mysql PDO Zend\Db\Adapter\Driver, Mysqli instance or MySQL PDO instance' - ); - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'MySQL'; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - return '`' . implode('`.`', (array) str_replace('`', '``', $identifierChain)) . '`'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if ($this->resource instanceof \mysqli) { - return '\'' . $this->resource->real_escape_string($value) . '\''; - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - return parent::quoteValue($value); - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if ($this->resource instanceof \mysqli) { - return '\'' . $this->resource->real_escape_string($value) . '\''; - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - return parent::quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Oracle.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Oracle.php deleted file mode 100644 index 7d66f937..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Oracle.php +++ /dev/null @@ -1,129 +0,0 @@ -quoteIdentifiers = false; - } - - if ($driver) { - $this->setDriver($driver); - } - } - - /** - * @param Pdo|Oci8 $driver - * @return self Provides a fluent interface - * @throws InvalidArgumentException - */ - public function setDriver($driver) - { - if ($driver instanceof Oci8 - || ($driver instanceof Pdo && $driver->getDatabasePlatformName() == 'Oracle') - || ($driver instanceof Pdo && $driver->getDatabasePlatformName() == 'Sqlite') - || ($driver instanceof \oci8) - || ($driver instanceof PDO && $driver->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') - ) { - $this->resource = $driver; - return $this; - } - - throw new InvalidArgumentException( - '$driver must be a Oci8 or Oracle PDO Zend\Db\Adapter\Driver, ' - . 'Oci8 instance, or Oci PDO instance' - ); - } - - /** - * @return null|Pdo|Oci8 - */ - public function getDriver() - { - return $this->resource; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'Oracle'; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - if ($this->quoteIdentifiers === false) { - return implode('.', (array) $identifierChain); - } - - return '"' . implode('"."', (array) str_replace('"', '\\"', $identifierChain)) . '"'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - - if ($this->resource) { - if ($this->resource instanceof PDO) { - return $this->resource->quote($value); - } - - if (get_resource_type($this->resource) == 'oci8 connection' - || get_resource_type($this->resource) == 'oci8 persistent connection' - ) { - return "'" . addcslashes(str_replace("'", "''", $value), "\x00\n\r\"\x1a") . "'"; - } - } - - trigger_error( - 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' - . 'can introduce security vulnerabilities in a production environment.' - ); - - return "'" . addcslashes(str_replace("'", "''", $value), "\x00\n\r\"\x1a") . "'"; - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - return "'" . addcslashes(str_replace('\'', '\'\'', $value), "\x00\n\r\"\x1a") . "'"; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php deleted file mode 100644 index 917fccf9..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php +++ /dev/null @@ -1,94 +0,0 @@ -setDriver($driver); - } - } - - /** - * @param \Zend\Db\Adapter\Driver\Pgsql\Pgsql|\Zend\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver - * @return self Provides a fluent interface - * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException - */ - public function setDriver($driver) - { - if ($driver instanceof Pgsql\Pgsql - || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Postgresql') - || (is_resource($driver) && (in_array(get_resource_type($driver), ['pgsql link', 'pgsql link persistent']))) - || ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'pgsql') - ) { - $this->resource = $driver; - return $this; - } - - throw new Exception\InvalidArgumentException( - '$driver must be a Pgsql or Postgresql PDO Zend\Db\Adapter\Driver, pgsql link resource or Postgresql PDO ' - . 'instance' - ); - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'PostgreSQL'; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - return '"' . implode('"."', (array) str_replace('"', '""', $identifierChain)) . '"'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if (is_resource($this->resource)) { - return '\'' . pg_escape_string($this->resource, $value) . '\''; - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - return 'E' . parent::quoteValue($value); - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if (is_resource($this->resource)) { - return '\'' . pg_escape_string($this->resource, $value) . '\''; - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - return 'E' . parent::quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sql92.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sql92.php deleted file mode 100644 index 81b7e0a2..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sql92.php +++ /dev/null @@ -1,33 +0,0 @@ -setDriver($driver); - } - } - - /** - * @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver - * @return self Provides a fluent interface - * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException - */ - public function setDriver($driver) - { - // handle Zend\Db drivers - if (($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), ['SqlServer', 'Dblib'])) - || ($driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), ['sqlsrv', 'dblib'])) - ) { - $this->resource = $driver; - return $this; - } - - throw new Exception\InvalidArgumentException( - '$driver must be a Sqlsrv PDO Zend\Db\Adapter\Driver or Sqlsrv PDO instance' - ); - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'SQLServer'; - } - - /** - * {@inheritDoc} - */ - public function getQuoteIdentifierSymbol() - { - return $this->quoteIdentifier; - } - - /** - * {@inheritDoc} - */ - public function quoteIdentifierChain($identifierChain) - { - return '[' . implode('].[', (array) $identifierChain) . ']'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - trigger_error( - 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' - . 'can introduce security vulnerabilities in a production environment.' - ); - - return '\'' . str_replace('\'', '\'\'', addcslashes($value, "\000\032")) . '\''; - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - if ($this->resource instanceof DriverInterface) { - $this->resource = $this->resource->getConnection()->getResource(); - } - if ($this->resource instanceof \PDO) { - return $this->resource->quote($value); - } - return '\'' . str_replace('\'', '\'\'', $value) . '\''; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sqlite.php b/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sqlite.php deleted file mode 100644 index 9253baba..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Platform/Sqlite.php +++ /dev/null @@ -1,105 +0,0 @@ -setDriver($driver); - } - } - - /** - * @param \Zend\Db\Adapter\Driver\Pdo\Pdo|\PDO $driver - * @return self Provides a fluent interface - * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException - */ - public function setDriver($driver) - { - if (($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlite') - || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlite') - ) { - $this->resource = $driver; - return $this; - } - - throw new Exception\InvalidArgumentException( - '$driver must be a Sqlite PDO Zend\Db\Adapter\Driver, Sqlite PDO instance' - ); - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'SQLite'; - } - - /** - * {@inheritDoc} - */ - public function quoteValue($value) - { - $resource = $this->resource; - - if ($resource instanceof DriverInterface) { - $resource = $resource->getConnection()->getResource(); - } - - if ($resource instanceof \PDO) { - return $resource->quote($value); - } - - return parent::quoteValue($value); - } - - /** - * {@inheritDoc} - */ - public function quoteTrustedValue($value) - { - $resource = $this->resource; - - if ($resource instanceof DriverInterface) { - $resource = $resource->getConnection()->getResource(); - } - - if ($resource instanceof \PDO) { - return $resource->quote($value); - } - - return parent::quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/Profiler.php b/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/Profiler.php deleted file mode 100644 index a853e83d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/Profiler.php +++ /dev/null @@ -1,89 +0,0 @@ - '', - 'parameters' => null, - 'start' => microtime(true), - 'end' => null, - 'elapse' => null - ]; - if ($target instanceof StatementContainerInterface) { - $profileInformation['sql'] = $target->getSql(); - $profileInformation['parameters'] = clone $target->getParameterContainer(); - } elseif (is_string($target)) { - $profileInformation['sql'] = $target; - } else { - throw new Exception\InvalidArgumentException( - __FUNCTION__ . ' takes either a StatementContainer or a string' - ); - } - - $this->profiles[$this->currentIndex] = $profileInformation; - - return $this; - } - - /** - * @return self Provides a fluent interface - */ - public function profilerFinish() - { - if (! isset($this->profiles[$this->currentIndex])) { - throw new Exception\RuntimeException( - 'A profile must be started before ' . __FUNCTION__ . ' can be called.' - ); - } - $current = &$this->profiles[$this->currentIndex]; - $current['end'] = microtime(true); - $current['elapse'] = $current['end'] - $current['start']; - $this->currentIndex++; - return $this; - } - - /** - * @return array|null - */ - public function getLastProfile() - { - return end($this->profiles); - } - - /** - * @return array - */ - public function getProfiles() - { - return $this->profiles; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php deleted file mode 100644 index ce47219b..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -setSql($sql); - } - $this->parameterContainer = ($parameterContainer) ?: new ParameterContainer; - } - - /** - * @param $sql - * @return self Provides a fluent interface - */ - public function setSql($sql) - { - $this->sql = $sql; - return $this; - } - - /** - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * @param ParameterContainer $parameterContainer - * @return self Provides a fluent interface - */ - public function setParameterContainer(ParameterContainer $parameterContainer) - { - $this->parameterContainer = $parameterContainer; - return $this; - } - - /** - * @return null|ParameterContainer - */ - public function getParameterContainer() - { - return $this->parameterContainer; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Adapter/StatementContainerInterface.php b/bundled-libs/zendframework/zend-db/src/Adapter/StatementContainerInterface.php deleted file mode 100644 index 30bb80ac..00000000 --- a/bundled-libs/zendframework/zend-db/src/Adapter/StatementContainerInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - $this->getDependencyConfig(), - ]; - } - - /** - * Retrieve zend-db default dependency configuration. - * - * @return array - */ - public function getDependencyConfig() - { - return [ - 'abstract_factories' => [ - Adapter\AdapterAbstractServiceFactory::class, - ], - 'factories' => [ - Adapter\AdapterInterface::class => Adapter\AdapterServiceFactory::class, - ], - 'aliases' => [ - Adapter\Adapter::class => Adapter\AdapterInterface::class, - ], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Exception/ErrorException.php b/bundled-libs/zendframework/zend-db/src/Exception/ErrorException.php deleted file mode 100644 index 95860433..00000000 --- a/bundled-libs/zendframework/zend-db/src/Exception/ErrorException.php +++ /dev/null @@ -1,14 +0,0 @@ -source = Source\Factory::createSourceFromAdapter($adapter); - } - - /** - * {@inheritdoc} - */ - public function getTables($schema = null, $includeViews = false) - { - return $this->source->getTables($schema, $includeViews); - } - - /** - * {@inheritdoc} - */ - public function getViews($schema = null) - { - return $this->source->getViews($schema); - } - - /** - * {@inheritdoc} - */ - public function getTriggers($schema = null) - { - return $this->source->getTriggers($schema); - } - - /** - * {@inheritdoc} - */ - public function getConstraints($table, $schema = null) - { - return $this->source->getConstraints($table, $schema); - } - - /** - * {@inheritdoc} - */ - public function getColumns($table, $schema = null) - { - return $this->source->getColumns($table, $schema); - } - - /** - * {@inheritdoc} - */ - public function getConstraintKeys($constraint, $table, $schema = null) - { - return $this->source->getConstraintKeys($constraint, $table, $schema); - } - - /** - * {@inheritdoc} - */ - public function getConstraint($constraintName, $table, $schema = null) - { - return $this->source->getConstraint($constraintName, $table, $schema); - } - - /** - * {@inheritdoc} - */ - public function getSchemas() - { - return $this->source->getSchemas(); - } - - /** - * {@inheritdoc} - */ - public function getTableNames($schema = null, $includeViews = false) - { - return $this->source->getTableNames($schema, $includeViews); - } - - /** - * {@inheritdoc} - */ - public function getTable($tableName, $schema = null) - { - return $this->source->getTable($tableName, $schema); - } - - /** - * {@inheritdoc} - */ - public function getViewNames($schema = null) - { - return $this->source->getViewNames($schema); - } - - /** - * {@inheritdoc} - */ - public function getView($viewName, $schema = null) - { - return $this->source->getView($viewName, $schema); - } - - /** - * {@inheritdoc} - */ - public function getTriggerNames($schema = null) - { - return $this->source->getTriggerNames($schema); - } - - /** - * {@inheritdoc} - */ - public function getTrigger($triggerName, $schema = null) - { - return $this->source->getTrigger($triggerName, $schema); - } - - /** - * {@inheritdoc} - */ - public function getColumnNames($table, $schema = null) - { - return $this->source->getColumnNames($table, $schema); - } - - /** - * {@inheritdoc} - */ - public function getColumn($columnName, $table, $schema = null) - { - return $this->source->getColumn($columnName, $table, $schema); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/MetadataInterface.php b/bundled-libs/zendframework/zend-db/src/Metadata/MetadataInterface.php deleted file mode 100644 index 5a395be2..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/MetadataInterface.php +++ /dev/null @@ -1,154 +0,0 @@ -setName($name); - } - } - - /** - * Set columns - * - * @param array $columns - */ - public function setColumns(array $columns) - { - $this->columns = $columns; - } - - /** - * Get columns - * - * @return array - */ - public function getColumns() - { - return $this->columns; - } - - /** - * Set constraints - * - * @param array $constraints - */ - public function setConstraints($constraints) - { - $this->constraints = $constraints; - } - - /** - * Get constraints - * - * @return array - */ - public function getConstraints() - { - return $this->constraints; - } - - /** - * Set name - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Get name - * - * @return string - */ - public function getName() - { - return $this->name; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ColumnObject.php b/bundled-libs/zendframework/zend-db/src/Metadata/Object/ColumnObject.php deleted file mode 100644 index f377119b..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ColumnObject.php +++ /dev/null @@ -1,388 +0,0 @@ -setName($name); - $this->setTableName($tableName); - $this->setSchemaName($schemaName); - } - - /** - * Set name - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Get name - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get table name - * - * @return string - */ - public function getTableName() - { - return $this->tableName; - } - - /** - * Set table name - * - * @param string $tableName - * @return self Provides a fluent interface - */ - public function setTableName($tableName) - { - $this->tableName = $tableName; - return $this; - } - - /** - * Set schema name - * - * @param string $schemaName - */ - public function setSchemaName($schemaName) - { - $this->schemaName = $schemaName; - } - - /** - * Get schema name - * - * @return string - */ - public function getSchemaName() - { - return $this->schemaName; - } - - /** - * @return int $ordinalPosition - */ - public function getOrdinalPosition() - { - return $this->ordinalPosition; - } - - /** - * @param int $ordinalPosition to set - * @return self Provides a fluent interface - */ - public function setOrdinalPosition($ordinalPosition) - { - $this->ordinalPosition = $ordinalPosition; - return $this; - } - - /** - * @return null|string the $columnDefault - */ - public function getColumnDefault() - { - return $this->columnDefault; - } - - /** - * @param mixed $columnDefault to set - * @return self Provides a fluent interface - */ - public function setColumnDefault($columnDefault) - { - $this->columnDefault = $columnDefault; - return $this; - } - - /** - * @return bool $isNullable - */ - public function getIsNullable() - { - return $this->isNullable; - } - - /** - * @param bool $isNullable to set - * @return self Provides a fluent interface - */ - public function setIsNullable($isNullable) - { - $this->isNullable = $isNullable; - return $this; - } - - /** - * @return bool $isNullable - */ - public function isNullable() - { - return $this->isNullable; - } - - /** - * @return null|string the $dataType - */ - public function getDataType() - { - return $this->dataType; - } - - /** - * @param string $dataType the $dataType to set - * @return self Provides a fluent interface - */ - public function setDataType($dataType) - { - $this->dataType = $dataType; - return $this; - } - - /** - * @return int|null the $characterMaximumLength - */ - public function getCharacterMaximumLength() - { - return $this->characterMaximumLength; - } - - /** - * @param int $characterMaximumLength the $characterMaximumLength to set - * @return self Provides a fluent interface - */ - public function setCharacterMaximumLength($characterMaximumLength) - { - $this->characterMaximumLength = $characterMaximumLength; - return $this; - } - - /** - * @return int|null the $characterOctetLength - */ - public function getCharacterOctetLength() - { - return $this->characterOctetLength; - } - - /** - * @param int $characterOctetLength the $characterOctetLength to set - * @return self Provides a fluent interface - */ - public function setCharacterOctetLength($characterOctetLength) - { - $this->characterOctetLength = $characterOctetLength; - return $this; - } - - /** - * @return int the $numericPrecision - */ - public function getNumericPrecision() - { - return $this->numericPrecision; - } - - /** - * @param int $numericPrecision the $numericPrevision to set - * @return self Provides a fluent interface - */ - public function setNumericPrecision($numericPrecision) - { - $this->numericPrecision = $numericPrecision; - return $this; - } - - /** - * @return int the $numericScale - */ - public function getNumericScale() - { - return $this->numericScale; - } - - /** - * @param int $numericScale the $numericScale to set - * @return self Provides a fluent interface - */ - public function setNumericScale($numericScale) - { - $this->numericScale = $numericScale; - return $this; - } - - /** - * @return bool - */ - public function getNumericUnsigned() - { - return $this->numericUnsigned; - } - - /** - * @param bool $numericUnsigned - * @return self Provides a fluent interface - */ - public function setNumericUnsigned($numericUnsigned) - { - $this->numericUnsigned = $numericUnsigned; - return $this; - } - - /** - * @return bool - */ - public function isNumericUnsigned() - { - return $this->numericUnsigned; - } - - /** - * @return array the $errata - */ - public function getErratas() - { - return $this->errata; - } - - /** - * @param array $erratas - * @return self Provides a fluent interface - */ - public function setErratas(array $erratas) - { - foreach ($erratas as $name => $value) { - $this->setErrata($name, $value); - } - return $this; - } - - /** - * @param string $errataName - * @return mixed - */ - public function getErrata($errataName) - { - if (array_key_exists($errataName, $this->errata)) { - return $this->errata[$errataName]; - } - return; - } - - /** - * @param string $errataName - * @param mixed $errataValue - * @return self Provides a fluent interface - */ - public function setErrata($errataName, $errataValue) - { - $this->errata[$errataName] = $errataValue; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php b/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php deleted file mode 100644 index 9bed4bff..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php +++ /dev/null @@ -1,249 +0,0 @@ -setColumnName($column); - } - - /** - * Get column name - * - * @return string - */ - public function getColumnName() - { - return $this->columnName; - } - - /** - * Set column name - * - * @param string $columnName - * @return self Provides a fluent interface - */ - public function setColumnName($columnName) - { - $this->columnName = $columnName; - return $this; - } - - /** - * Get ordinal position - * - * @return int - */ - public function getOrdinalPosition() - { - return $this->ordinalPosition; - } - - /** - * Set ordinal position - * - * @param int $ordinalPosition - * @return self Provides a fluent interface - */ - public function setOrdinalPosition($ordinalPosition) - { - $this->ordinalPosition = $ordinalPosition; - return $this; - } - - /** - * Get position in unique constraint - * - * @return bool - */ - public function getPositionInUniqueConstraint() - { - return $this->positionInUniqueConstraint; - } - - /** - * Set position in unique constraint - * - * @param bool $positionInUniqueConstraint - * @return self Provides a fluent interface - */ - public function setPositionInUniqueConstraint($positionInUniqueConstraint) - { - $this->positionInUniqueConstraint = $positionInUniqueConstraint; - return $this; - } - - /** - * Get referencred table schema - * - * @return string - */ - public function getReferencedTableSchema() - { - return $this->referencedTableSchema; - } - - /** - * Set referenced table schema - * - * @param string $referencedTableSchema - * @return self Provides a fluent interface - */ - public function setReferencedTableSchema($referencedTableSchema) - { - $this->referencedTableSchema = $referencedTableSchema; - return $this; - } - - /** - * Get referenced table name - * - * @return string - */ - public function getReferencedTableName() - { - return $this->referencedTableName; - } - - /** - * Set Referenced table name - * - * @param string $referencedTableName - * @return self Provides a fluent interface - */ - public function setReferencedTableName($referencedTableName) - { - $this->referencedTableName = $referencedTableName; - return $this; - } - - /** - * Get referenced column name - * - * @return string - */ - public function getReferencedColumnName() - { - return $this->referencedColumnName; - } - - /** - * Set referenced column name - * - * @param string $referencedColumnName - * @return self Provides a fluent interface - */ - public function setReferencedColumnName($referencedColumnName) - { - $this->referencedColumnName = $referencedColumnName; - return $this; - } - - /** - * set foreign key update rule - * - * @param string $foreignKeyUpdateRule - */ - public function setForeignKeyUpdateRule($foreignKeyUpdateRule) - { - $this->foreignKeyUpdateRule = $foreignKeyUpdateRule; - } - - /** - * Get foreign key update rule - * - * @return string - */ - public function getForeignKeyUpdateRule() - { - return $this->foreignKeyUpdateRule; - } - - /** - * Set foreign key delete rule - * - * @param string $foreignKeyDeleteRule - */ - public function setForeignKeyDeleteRule($foreignKeyDeleteRule) - { - $this->foreignKeyDeleteRule = $foreignKeyDeleteRule; - } - - /** - * get foreign key delete rule - * - * @return string - */ - public function getForeignKeyDeleteRule() - { - return $this->foreignKeyDeleteRule; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php b/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php deleted file mode 100644 index 15f79729..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php +++ /dev/null @@ -1,411 +0,0 @@ -setName($name); - $this->setTableName($tableName); - $this->setSchemaName($schemaName); - } - - /** - * Set name - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Get name - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set schema name - * - * @param string $schemaName - */ - public function setSchemaName($schemaName) - { - $this->schemaName = $schemaName; - } - - /** - * Get schema name - * - * @return string - */ - public function getSchemaName() - { - return $this->schemaName; - } - - /** - * Get table name - * - * @return string - */ - public function getTableName() - { - return $this->tableName; - } - - /** - * Set table name - * - * @param string $tableName - * @return self Provides a fluent interface - */ - public function setTableName($tableName) - { - $this->tableName = $tableName; - return $this; - } - - /** - * Set type - * - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * Get type - * - * @return string - */ - public function getType() - { - return $this->type; - } - - public function hasColumns() - { - return (! empty($this->columns)); - } - - /** - * Get Columns. - * - * @return string[] - */ - public function getColumns() - { - return $this->columns; - } - - /** - * Set Columns. - * - * @param string[] $columns - * @return self Provides a fluent interface - */ - public function setColumns(array $columns) - { - $this->columns = $columns; - return $this; - } - - /** - * Get Referenced Table Schema. - * - * @return string - */ - public function getReferencedTableSchema() - { - return $this->referencedTableSchema; - } - - /** - * Set Referenced Table Schema. - * - * @param string $referencedTableSchema - * @return self Provides a fluent interface - */ - public function setReferencedTableSchema($referencedTableSchema) - { - $this->referencedTableSchema = $referencedTableSchema; - return $this; - } - - /** - * Get Referenced Table Name. - * - * @return string - */ - public function getReferencedTableName() - { - return $this->referencedTableName; - } - - /** - * Set Referenced Table Name. - * - * @param string $referencedTableName - * @return self Provides a fluent interface - */ - public function setReferencedTableName($referencedTableName) - { - $this->referencedTableName = $referencedTableName; - return $this; - } - - /** - * Get Referenced Columns. - * - * @return string[] - */ - public function getReferencedColumns() - { - return $this->referencedColumns; - } - - /** - * Set Referenced Columns. - * - * @param string[] $referencedColumns - * @return self Provides a fluent interface - */ - public function setReferencedColumns(array $referencedColumns) - { - $this->referencedColumns = $referencedColumns; - return $this; - } - - /** - * Get Match Option. - * - * @return string - */ - public function getMatchOption() - { - return $this->matchOption; - } - - /** - * Set Match Option. - * - * @param string $matchOption - * @return self Provides a fluent interface - */ - public function setMatchOption($matchOption) - { - $this->matchOption = $matchOption; - return $this; - } - - /** - * Get Update Rule. - * - * @return string - */ - public function getUpdateRule() - { - return $this->updateRule; - } - - /** - * Set Update Rule. - * - * @param string $updateRule - * @return self Provides a fluent interface - */ - public function setUpdateRule($updateRule) - { - $this->updateRule = $updateRule; - return $this; - } - - /** - * Get Delete Rule. - * - * @return string - */ - public function getDeleteRule() - { - return $this->deleteRule; - } - - /** - * Set Delete Rule. - * - * @param string $deleteRule - * @return self Provides a fluent interface - */ - public function setDeleteRule($deleteRule) - { - $this->deleteRule = $deleteRule; - return $this; - } - - /** - * Get Check Clause. - * - * @return string - */ - public function getCheckClause() - { - return $this->checkClause; - } - - /** - * Set Check Clause. - * - * @param string $checkClause - * @return self Provides a fluent interface - */ - public function setCheckClause($checkClause) - { - $this->checkClause = $checkClause; - return $this; - } - - /** - * Is primary key - * - * @return bool - */ - public function isPrimaryKey() - { - return ('PRIMARY KEY' == $this->type); - } - - /** - * Is unique key - * - * @return bool - */ - public function isUnique() - { - return ('UNIQUE' == $this->type); - } - - /** - * Is foreign key - * - * @return bool - */ - public function isForeignKey() - { - return ('FOREIGN KEY' == $this->type); - } - - /** - * Is foreign key - * - * @return bool - */ - public function isCheck() - { - return ('CHECK' == $this->type); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Object/TableObject.php b/bundled-libs/zendframework/zend-db/src/Metadata/Object/TableObject.php deleted file mode 100644 index 291796ea..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Object/TableObject.php +++ /dev/null @@ -1,14 +0,0 @@ -name; - } - - /** - * Set Name. - * - * @param string $name - * @return self Provides a fluent interface - */ - public function setName($name) - { - $this->name = $name; - return $this; - } - - /** - * Get Event Manipulation. - * - * @return string - */ - public function getEventManipulation() - { - return $this->eventManipulation; - } - - /** - * Set Event Manipulation. - * - * @param string $eventManipulation - * @return self Provides a fluent interface - */ - public function setEventManipulation($eventManipulation) - { - $this->eventManipulation = $eventManipulation; - return $this; - } - - /** - * Get Event Object Catalog. - * - * @return string - */ - public function getEventObjectCatalog() - { - return $this->eventObjectCatalog; - } - - /** - * Set Event Object Catalog. - * - * @param string $eventObjectCatalog - * @return self Provides a fluent interface - */ - public function setEventObjectCatalog($eventObjectCatalog) - { - $this->eventObjectCatalog = $eventObjectCatalog; - return $this; - } - - /** - * Get Event Object Schema. - * - * @return string - */ - public function getEventObjectSchema() - { - return $this->eventObjectSchema; - } - - /** - * Set Event Object Schema. - * - * @param string $eventObjectSchema - * @return self Provides a fluent interface - */ - public function setEventObjectSchema($eventObjectSchema) - { - $this->eventObjectSchema = $eventObjectSchema; - return $this; - } - - /** - * Get Event Object Table. - * - * @return string - */ - public function getEventObjectTable() - { - return $this->eventObjectTable; - } - - /** - * Set Event Object Table. - * - * @param string $eventObjectTable - * @return self Provides a fluent interface - */ - public function setEventObjectTable($eventObjectTable) - { - $this->eventObjectTable = $eventObjectTable; - return $this; - } - - /** - * Get Action Order. - * - * @return string - */ - public function getActionOrder() - { - return $this->actionOrder; - } - - /** - * Set Action Order. - * - * @param string $actionOrder - * @return self Provides a fluent interface - */ - public function setActionOrder($actionOrder) - { - $this->actionOrder = $actionOrder; - return $this; - } - - /** - * Get Action Condition. - * - * @return string - */ - public function getActionCondition() - { - return $this->actionCondition; - } - - /** - * Set Action Condition. - * - * @param string $actionCondition - * @return self Provides a fluent interface - */ - public function setActionCondition($actionCondition) - { - $this->actionCondition = $actionCondition; - return $this; - } - - /** - * Get Action Statement. - * - * @return string - */ - public function getActionStatement() - { - return $this->actionStatement; - } - - /** - * Set Action Statement. - * - * @param string $actionStatement - * @return self Provides a fluent interface - */ - public function setActionStatement($actionStatement) - { - $this->actionStatement = $actionStatement; - return $this; - } - - /** - * Get Action Orientation. - * - * @return string - */ - public function getActionOrientation() - { - return $this->actionOrientation; - } - - /** - * Set Action Orientation. - * - * @param string $actionOrientation - * @return self Provides a fluent interface - */ - public function setActionOrientation($actionOrientation) - { - $this->actionOrientation = $actionOrientation; - return $this; - } - - /** - * Get Action Timing. - * - * @return string - */ - public function getActionTiming() - { - return $this->actionTiming; - } - - /** - * Set Action Timing. - * - * @param string $actionTiming - * @return self Provides a fluent interface - */ - public function setActionTiming($actionTiming) - { - $this->actionTiming = $actionTiming; - return $this; - } - - /** - * Get Action Reference Old Table. - * - * @return string - */ - public function getActionReferenceOldTable() - { - return $this->actionReferenceOldTable; - } - - /** - * Set Action Reference Old Table. - * - * @param string $actionReferenceOldTable - * @return self Provides a fluent interface - */ - public function setActionReferenceOldTable($actionReferenceOldTable) - { - $this->actionReferenceOldTable = $actionReferenceOldTable; - return $this; - } - - /** - * Get Action Reference New Table. - * - * @return string - */ - public function getActionReferenceNewTable() - { - return $this->actionReferenceNewTable; - } - - /** - * Set Action Reference New Table. - * - * @param string $actionReferenceNewTable - * @return self Provides a fluent interface - */ - public function setActionReferenceNewTable($actionReferenceNewTable) - { - $this->actionReferenceNewTable = $actionReferenceNewTable; - return $this; - } - - /** - * Get Action Reference Old Row. - * - * @return string - */ - public function getActionReferenceOldRow() - { - return $this->actionReferenceOldRow; - } - - /** - * Set Action Reference Old Row. - * - * @param string $actionReferenceOldRow - * @return self Provides a fluent interface - */ - public function setActionReferenceOldRow($actionReferenceOldRow) - { - $this->actionReferenceOldRow = $actionReferenceOldRow; - return $this; - } - - /** - * Get Action Reference New Row. - * - * @return string - */ - public function getActionReferenceNewRow() - { - return $this->actionReferenceNewRow; - } - - /** - * Set Action Reference New Row. - * - * @param string $actionReferenceNewRow - * @return self Provides a fluent interface - */ - public function setActionReferenceNewRow($actionReferenceNewRow) - { - $this->actionReferenceNewRow = $actionReferenceNewRow; - return $this; - } - - /** - * Get Created. - * - * @return \DateTime - */ - public function getCreated() - { - return $this->created; - } - - /** - * Set Created. - * - * @param \DateTime $created - * @return self Provides a fluent interface - */ - public function setCreated($created) - { - $this->created = $created; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ViewObject.php b/bundled-libs/zendframework/zend-db/src/Metadata/Object/ViewObject.php deleted file mode 100644 index e0b5bde1..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Object/ViewObject.php +++ /dev/null @@ -1,76 +0,0 @@ -viewDefinition; - } - - /** - * @param string $viewDefinition to set - * @return self Provides a fluent interface - */ - public function setViewDefinition($viewDefinition) - { - $this->viewDefinition = $viewDefinition; - return $this; - } - - /** - * @return string $checkOption - */ - public function getCheckOption() - { - return $this->checkOption; - } - - /** - * @param string $checkOption to set - * @return self Provides a fluent interface - */ - public function setCheckOption($checkOption) - { - $this->checkOption = $checkOption; - return $this; - } - - /** - * @return bool $isUpdatable - */ - public function getIsUpdatable() - { - return $this->isUpdatable; - } - - /** - * @param bool $isUpdatable to set - * @return self Provides a fluent interface - */ - public function setIsUpdatable($isUpdatable) - { - $this->isUpdatable = $isUpdatable; - return $this; - } - - public function isUpdatable() - { - return $this->isUpdatable; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/AbstractSource.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/AbstractSource.php deleted file mode 100644 index 0bd5c162..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/AbstractSource.php +++ /dev/null @@ -1,549 +0,0 @@ -adapter = $adapter; - $this->defaultSchema = ($adapter->getCurrentSchema()) ?: self::DEFAULT_SCHEMA; - } - - /** - * Get schemas - * - */ - public function getSchemas() - { - $this->loadSchemaData(); - - return $this->data['schemas']; - } - - /** - * {@inheritdoc} - */ - public function getTableNames($schema = null, $includeViews = false) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTableNameData($schema); - - if ($includeViews) { - return array_keys($this->data['table_names'][$schema]); - } - - $tableNames = []; - foreach ($this->data['table_names'][$schema] as $tableName => $data) { - if ('BASE TABLE' == $data['table_type']) { - $tableNames[] = $tableName; - } - } - return $tableNames; - } - - /** - * {@inheritdoc} - */ - public function getTables($schema = null, $includeViews = false) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $tables = []; - foreach ($this->getTableNames($schema, $includeViews) as $tableName) { - $tables[] = $this->getTable($tableName, $schema); - } - return $tables; - } - - /** - * {@inheritdoc} - */ - public function getTable($tableName, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTableNameData($schema); - - if (! isset($this->data['table_names'][$schema][$tableName])) { - throw new \Exception('Table "' . $tableName . '" does not exist'); - } - - $data = $this->data['table_names'][$schema][$tableName]; - switch ($data['table_type']) { - case 'BASE TABLE': - $table = new TableObject($tableName); - break; - case 'VIEW': - $table = new ViewObject($tableName); - $table->setViewDefinition($data['view_definition']); - $table->setCheckOption($data['check_option']); - $table->setIsUpdatable($data['is_updatable']); - break; - default: - throw new \Exception( - 'Table "' . $tableName . '" is of an unsupported type "' . $data['table_type'] . '"' - ); - } - $table->setColumns($this->getColumns($tableName, $schema)); - $table->setConstraints($this->getConstraints($tableName, $schema)); - return $table; - } - - /** - * {@inheritdoc} - */ - public function getViewNames($schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTableNameData($schema); - - $viewNames = []; - foreach ($this->data['table_names'][$schema] as $tableName => $data) { - if ('VIEW' == $data['table_type']) { - $viewNames[] = $tableName; - } - } - return $viewNames; - } - - /** - * {@inheritdoc} - */ - public function getViews($schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $views = []; - foreach ($this->getViewNames($schema) as $tableName) { - $views[] = $this->getTable($tableName, $schema); - } - return $views; - } - - /** - * {@inheritdoc} - */ - public function getView($viewName, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTableNameData($schema); - - $tableNames = $this->data['table_names'][$schema]; - if (isset($tableNames[$viewName]) && 'VIEW' == $tableNames[$viewName]['table_type']) { - return $this->getTable($viewName, $schema); - } - throw new \Exception('View "' . $viewName . '" does not exist'); - } - - /** - * {@inheritdoc} - */ - public function getColumnNames($table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadColumnData($table, $schema); - - if (! isset($this->data['columns'][$schema][$table])) { - throw new \Exception('"' . $table . '" does not exist'); - } - - return array_keys($this->data['columns'][$schema][$table]); - } - - /** - * {@inheritdoc} - */ - public function getColumns($table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadColumnData($table, $schema); - - $columns = []; - foreach ($this->getColumnNames($table, $schema) as $columnName) { - $columns[] = $this->getColumn($columnName, $table, $schema); - } - return $columns; - } - - /** - * {@inheritdoc} - */ - public function getColumn($columnName, $table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadColumnData($table, $schema); - - if (! isset($this->data['columns'][$schema][$table][$columnName])) { - throw new \Exception('A column by that name was not found.'); - } - - $info = $this->data['columns'][$schema][$table][$columnName]; - - $column = new ColumnObject($columnName, $table, $schema); - $props = [ - 'ordinal_position', 'column_default', 'is_nullable', - 'data_type', 'character_maximum_length', 'character_octet_length', - 'numeric_precision', 'numeric_scale', 'numeric_unsigned', - 'erratas' - ]; - foreach ($props as $prop) { - if (isset($info[$prop])) { - $column->{'set' . str_replace('_', '', $prop)}($info[$prop]); - } - } - - $column->setOrdinalPosition($info['ordinal_position']); - $column->setColumnDefault($info['column_default']); - $column->setIsNullable($info['is_nullable']); - $column->setDataType($info['data_type']); - $column->setCharacterMaximumLength($info['character_maximum_length']); - $column->setCharacterOctetLength($info['character_octet_length']); - $column->setNumericPrecision($info['numeric_precision']); - $column->setNumericScale($info['numeric_scale']); - $column->setNumericUnsigned($info['numeric_unsigned']); - $column->setErratas($info['erratas']); - - return $column; - } - - /** - * {@inheritdoc} - */ - public function getConstraints($table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadConstraintData($table, $schema); - - $constraints = []; - foreach (array_keys($this->data['constraints'][$schema][$table]) as $constraintName) { - $constraints[] = $this->getConstraint($constraintName, $table, $schema); - } - - return $constraints; - } - - /** - * {@inheritdoc} - */ - public function getConstraint($constraintName, $table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadConstraintData($table, $schema); - - if (! isset($this->data['constraints'][$schema][$table][$constraintName])) { - throw new \Exception('Cannot find a constraint by that name in this table'); - } - - $info = $this->data['constraints'][$schema][$table][$constraintName]; - $constraint = new ConstraintObject($constraintName, $table, $schema); - - foreach ([ - 'constraint_type' => 'setType', - 'match_option' => 'setMatchOption', - 'update_rule' => 'setUpdateRule', - 'delete_rule' => 'setDeleteRule', - 'columns' => 'setColumns', - 'referenced_table_schema' => 'setReferencedTableSchema', - 'referenced_table_name' => 'setReferencedTableName', - 'referenced_columns' => 'setReferencedColumns', - 'check_clause' => 'setCheckClause', - ] as $key => $setMethod) { - if (isset($info[$key])) { - $constraint->{$setMethod}($info[$key]); - } - } - - return $constraint; - } - - /** - * {@inheritdoc} - */ - public function getConstraintKeys($constraint, $table, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadConstraintReferences($table, $schema); - - // organize references first - $references = []; - foreach ($this->data['constraint_references'][$schema] as $refKeyInfo) { - if ($refKeyInfo['constraint_name'] == $constraint) { - $references[$refKeyInfo['constraint_name']] = $refKeyInfo; - } - } - - $this->loadConstraintDataKeys($schema); - - $keys = []; - foreach ($this->data['constraint_keys'][$schema] as $constraintKeyInfo) { - if ($constraintKeyInfo['table_name'] == $table && $constraintKeyInfo['constraint_name'] === $constraint) { - $keys[] = $key = new ConstraintKeyObject($constraintKeyInfo['column_name']); - $key->setOrdinalPosition($constraintKeyInfo['ordinal_position']); - if (isset($references[$constraint])) { - //$key->setReferencedTableSchema($constraintKeyInfo['referenced_table_schema']); - $key->setForeignKeyUpdateRule($references[$constraint]['update_rule']); - $key->setForeignKeyDeleteRule($references[$constraint]['delete_rule']); - //$key->setReferencedTableSchema($references[$constraint]['referenced_table_schema']); - $key->setReferencedTableName($references[$constraint]['referenced_table_name']); - $key->setReferencedColumnName($references[$constraint]['referenced_column_name']); - } - } - } - - return $keys; - } - - /** - * {@inheritdoc} - */ - public function getTriggerNames($schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTriggerData($schema); - - return array_keys($this->data['triggers'][$schema]); - } - - /** - * {@inheritdoc} - */ - public function getTriggers($schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $triggers = []; - foreach ($this->getTriggerNames($schema) as $triggerName) { - $triggers[] = $this->getTrigger($triggerName, $schema); - } - return $triggers; - } - - /** - * {@inheritdoc} - */ - public function getTrigger($triggerName, $schema = null) - { - if ($schema === null) { - $schema = $this->defaultSchema; - } - - $this->loadTriggerData($schema); - - if (! isset($this->data['triggers'][$schema][$triggerName])) { - throw new \Exception('Trigger "' . $triggerName . '" does not exist'); - } - - $info = $this->data['triggers'][$schema][$triggerName]; - - $trigger = new TriggerObject(); - - $trigger->setName($triggerName); - $trigger->setEventManipulation($info['event_manipulation']); - $trigger->setEventObjectCatalog($info['event_object_catalog']); - $trigger->setEventObjectSchema($info['event_object_schema']); - $trigger->setEventObjectTable($info['event_object_table']); - $trigger->setActionOrder($info['action_order']); - $trigger->setActionCondition($info['action_condition']); - $trigger->setActionStatement($info['action_statement']); - $trigger->setActionOrientation($info['action_orientation']); - $trigger->setActionTiming($info['action_timing']); - $trigger->setActionReferenceOldTable($info['action_reference_old_table']); - $trigger->setActionReferenceNewTable($info['action_reference_new_table']); - $trigger->setActionReferenceOldRow($info['action_reference_old_row']); - $trigger->setActionReferenceNewRow($info['action_reference_new_row']); - $trigger->setCreated($info['created']); - - return $trigger; - } - - /** - * Prepare data hierarchy - * - * @param string $type - * @param string $key ... - */ - protected function prepareDataHierarchy($type) - { - $data = &$this->data; - foreach (func_get_args() as $key) { - if (! isset($data[$key])) { - $data[$key] = []; - } - $data = &$data[$key]; - } - } - - /** - * Load schema data - */ - protected function loadSchemaData() - { - } - - /** - * Load table name data - * - * @param string $schema - */ - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return; - } - - $this->prepareDataHierarchy('table_names', $schema); - } - - /** - * Load column data - * - * @param string $table - * @param string $schema - */ - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('columns', $schema, $table); - } - - /** - * Load constraint data - * - * @param string $table - * @param string $schema - */ - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema); - } - - /** - * Load constraint data keys - * - * @param string $schema - */ - protected function loadConstraintDataKeys($schema) - { - if (isset($this->data['constraint_keys'][$schema])) { - return; - } - - $this->prepareDataHierarchy('constraint_keys', $schema); - } - - /** - * Load constraint references - * - * @param string $table - * @param string $schema - */ - protected function loadConstraintReferences($table, $schema) - { - if (isset($this->data['constraint_references'][$schema])) { - return; - } - - $this->prepareDataHierarchy('constraint_references', $schema); - } - - /** - * Load trigger data - * - * @param string $schema - */ - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/Factory.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/Factory.php deleted file mode 100644 index fb8ec718..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/Factory.php +++ /dev/null @@ -1,47 +0,0 @@ -getPlatform()->getName(); - - switch ($platformName) { - case 'MySQL': - return new MysqlMetadata($adapter); - case 'SQLServer': - return new SqlServerMetadata($adapter); - case 'SQLite': - return new SqliteMetadata($adapter); - case 'PostgreSQL': - return new PostgresqlMetadata($adapter); - case 'Oracle': - return new OracleMetadata($adapter); - default: - throw new InvalidArgumentException("Unknown adapter platform '{$platformName}'"); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php deleted file mode 100644 index c366fe99..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php +++ /dev/null @@ -1,503 +0,0 @@ -data['schemas'])) { - return; - } - $this->prepareDataHierarchy('schemas'); - - $p = $this->adapter->getPlatform(); - - $sql = 'SELECT ' . $p->quoteIdentifier('SCHEMA_NAME') - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'SCHEMATA']) - . ' WHERE ' . $p->quoteIdentifier('SCHEMA_NAME') - . ' != \'INFORMATION_SCHEMA\''; - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $schemas = []; - foreach ($results->toArray() as $row) { - $schemas[] = $row['SCHEMA_NAME']; - } - - $this->data['schemas'] = $schemas; - } - - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return; - } - $this->prepareDataHierarchy('table_names', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['T', 'TABLE_NAME'], - ['T', 'TABLE_TYPE'], - ['V', 'VIEW_DEFINITION'], - ['V', 'CHECK_OPTION'], - ['V', 'IS_UPDATABLE'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'VIEWS']) . ' V' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_NAME']) - - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $tables = []; - foreach ($results->toArray() as $row) { - $tables[$row['TABLE_NAME']] = [ - 'table_type' => $row['TABLE_TYPE'], - 'view_definition' => $row['VIEW_DEFINITION'], - 'check_option' => $row['CHECK_OPTION'], - 'is_updatable' => ('YES' == $row['IS_UPDATABLE']), - ]; - } - - $this->data['table_names'][$schema] = $tables; - } - - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - $this->prepareDataHierarchy('columns', $schema, $table); - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['C', 'ORDINAL_POSITION'], - ['C', 'COLUMN_DEFAULT'], - ['C', 'IS_NULLABLE'], - ['C', 'DATA_TYPE'], - ['C', 'CHARACTER_MAXIMUM_LENGTH'], - ['C', 'CHARACTER_OCTET_LENGTH'], - ['C', 'NUMERIC_PRECISION'], - ['C', 'NUMERIC_SCALE'], - ['C', 'COLUMN_NAME'], - ['C', 'COLUMN_TYPE'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'COLUMNS']) . 'C' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_NAME']) - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')' - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteTrustedValue($table); - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - $columns = []; - foreach ($results->toArray() as $row) { - $erratas = []; - $matches = []; - if (preg_match('/^(?:enum|set)\((.+)\)$/i', $row['COLUMN_TYPE'], $matches)) { - $permittedValues = $matches[1]; - if (preg_match_all( - "/\\s*'((?:[^']++|'')*+)'\\s*(?:,|\$)/", - $permittedValues, - $matches, - PREG_PATTERN_ORDER - ) - ) { - $permittedValues = str_replace("''", "'", $matches[1]); - } else { - $permittedValues = [$permittedValues]; - } - $erratas['permitted_values'] = $permittedValues; - } - $columns[$row['COLUMN_NAME']] = [ - 'ordinal_position' => $row['ORDINAL_POSITION'], - 'column_default' => $row['COLUMN_DEFAULT'], - 'is_nullable' => ('YES' == $row['IS_NULLABLE']), - 'data_type' => $row['DATA_TYPE'], - 'character_maximum_length' => $row['CHARACTER_MAXIMUM_LENGTH'], - 'character_octet_length' => $row['CHARACTER_OCTET_LENGTH'], - 'numeric_precision' => $row['NUMERIC_PRECISION'], - 'numeric_scale' => $row['NUMERIC_SCALE'], - 'numeric_unsigned' => (false !== strpos($row['COLUMN_TYPE'], 'unsigned')), - 'erratas' => $erratas, - ]; - } - - $this->data['columns'][$schema][$table] = $columns; - } - - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema, $table); - - $isColumns = [ - ['T', 'TABLE_NAME'], - ['TC', 'CONSTRAINT_NAME'], - ['TC', 'CONSTRAINT_TYPE'], - ['KCU', 'COLUMN_NAME'], - ['RC', 'MATCH_OPTION'], - ['RC', 'UPDATE_RULE'], - ['RC', 'DELETE_RULE'], - ['KCU', 'REFERENCED_TABLE_SCHEMA'], - ['KCU', 'REFERENCED_TABLE_NAME'], - ['KCU', 'REFERENCED_COLUMN_NAME'], - ]; - - $p = $this->adapter->getPlatform(); - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' T' - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . ' TC' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU' - . ' ON ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . ' RC' - . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) - - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteTrustedValue($table) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_TYPE']) - . " WHEN 'PRIMARY KEY' THEN 1" - . " WHEN 'UNIQUE' THEN 2" - . " WHEN 'FOREIGN KEY' THEN 3" - . " ELSE 4 END" - - . ', ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ', ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']); - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $realName = null; - $constraints = []; - foreach ($results->toArray() as $row) { - if ($row['CONSTRAINT_NAME'] !== $realName) { - $realName = $row['CONSTRAINT_NAME']; - $isFK = ('FOREIGN KEY' == $row['CONSTRAINT_TYPE']); - if ($isFK) { - $name = $realName; - } else { - $name = '_zf_' . $row['TABLE_NAME'] . '_' . $realName; - } - $constraints[$name] = [ - 'constraint_name' => $name, - 'constraint_type' => $row['CONSTRAINT_TYPE'], - 'table_name' => $row['TABLE_NAME'], - 'columns' => [], - ]; - if ($isFK) { - $constraints[$name]['referenced_table_schema'] = $row['REFERENCED_TABLE_SCHEMA']; - $constraints[$name]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME']; - $constraints[$name]['referenced_columns'] = []; - $constraints[$name]['match_option'] = $row['MATCH_OPTION']; - $constraints[$name]['update_rule'] = $row['UPDATE_RULE']; - $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; - } - } - $constraints[$name]['columns'][] = $row['COLUMN_NAME']; - if ($isFK) { - $constraints[$name]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; - } - } - - $this->data['constraints'][$schema][$table] = $constraints; - } - - protected function loadConstraintDataNames($schema) - { - if (isset($this->data['constraint_names'][$schema])) { - return; - } - - $this->prepareDataHierarchy('constraint_names', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['TC', 'TABLE_NAME'], - ['TC', 'CONSTRAINT_NAME'], - ['TC', 'CONSTRAINT_TYPE'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . 'TC' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $data[] = array_change_key_case($row, CASE_LOWER); - } - - $this->data['constraint_names'][$schema] = $data; - } - - protected function loadConstraintDataKeys($schema) - { - if (isset($this->data['constraint_keys'][$schema])) { - return; - } - - $this->prepareDataHierarchy('constraint_keys', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['T', 'TABLE_NAME'], - ['KCU', 'CONSTRAINT_NAME'], - ['KCU', 'COLUMN_NAME'], - ['KCU', 'ORDINAL_POSITION'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . 'KCU' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) - - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $data[] = array_change_key_case($row, CASE_LOWER); - } - - $this->data['constraint_keys'][$schema] = $data; - } - - protected function loadConstraintReferences($table, $schema) - { - parent::loadConstraintReferences($table, $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['RC', 'TABLE_NAME'], - ['RC', 'CONSTRAINT_NAME'], - ['RC', 'UPDATE_RULE'], - ['RC', 'DELETE_RULE'], - ['KCU', 'REFERENCED_TABLE_SCHEMA'], - ['KCU', 'REFERENCED_TABLE_NAME'], - ['KCU', 'REFERENCED_COLUMN_NAME'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . 'FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . 'RC' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'TABLE_NAME']) - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . 'KCU' - . ' ON ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['RC', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) - . ' AND ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) - - . 'WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $data[] = array_change_key_case($row, CASE_LOWER); - } - - $this->data['constraint_references'][$schema] = $data; - } - - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ -// 'TRIGGER_CATALOG', -// 'TRIGGER_SCHEMA', - 'TRIGGER_NAME', - 'EVENT_MANIPULATION', - 'EVENT_OBJECT_CATALOG', - 'EVENT_OBJECT_SCHEMA', - 'EVENT_OBJECT_TABLE', - 'ACTION_ORDER', - 'ACTION_CONDITION', - 'ACTION_STATEMENT', - 'ACTION_ORIENTATION', - 'ACTION_TIMING', - 'ACTION_REFERENCE_OLD_TABLE', - 'ACTION_REFERENCE_NEW_TABLE', - 'ACTION_REFERENCE_OLD_ROW', - 'ACTION_REFERENCE_NEW_ROW', - 'CREATED', - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifier($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TRIGGERS']) - . ' WHERE '; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $row = array_change_key_case($row, CASE_LOWER); - if (null !== $row['created']) { - $row['created'] = new \DateTime($row['created']); - } - $data[$row['trigger_name']] = $row; - } - - $this->data['triggers'][$schema] = $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php deleted file mode 100644 index 0ffa743d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php +++ /dev/null @@ -1,256 +0,0 @@ - 'CHECK', - 'P' => 'PRIMARY KEY', - 'R' => 'FOREIGN_KEY' - ]; - - /** - * {@inheritdoc} - * @see \Zend\Db\Metadata\Source\AbstractSource::loadColumnData() - */ - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - - $isColumns = [ - 'COLUMN_ID', - 'COLUMN_NAME', - 'DATA_DEFAULT', - 'NULLABLE', - 'DATA_TYPE', - 'DATA_LENGTH', - 'DATA_PRECISION', - 'DATA_SCALE' - ]; - - $this->prepareDataHierarchy('columns', $schema, $table); - $parameters = [ - ':ownername' => $schema, - ':tablename' => $table - ]; - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM all_tab_columns' - . ' WHERE owner = :ownername AND table_name = :tablename'; - - $result = $this->adapter->query($sql)->execute($parameters); - $columns = []; - - foreach ($result as $row) { - $columns[$row['COLUMN_NAME']] = [ - 'ordinal_position' => $row['COLUMN_ID'], - 'column_default' => $row['DATA_DEFAULT'], - 'is_nullable' => ('Y' == $row['NULLABLE']), - 'data_type' => $row['DATA_TYPE'], - 'character_maximum_length' => $row['DATA_LENGTH'], - 'character_octet_length' => null, - 'numeric_precision' => $row['DATA_PRECISION'], - 'numeric_scale' => $row['DATA_SCALE'], - 'numeric_unsigned' => false, - 'erratas' => [], - ]; - } - - $this->data['columns'][$schema][$table] = $columns; - return $this; - } - - /** - * Constraint type - * - * @param string $type - * @return string - */ - protected function getConstraintType($type) - { - if (isset($this->constraintTypeMap[$type])) { - return $this->constraintTypeMap[$type]; - } - - return $type; - } - - /** - * {@inheritdoc} - * @see \Zend\Db\Metadata\Source\AbstractSource::loadConstraintData() - */ - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema, $table); - $sql = ' - SELECT - ac.owner, - ac.constraint_name, - ac.constraint_type, - ac.search_condition check_clause, - ac.table_name, - ac.delete_rule, - cc1.column_name, - cc2.table_name as ref_table, - cc2.column_name as ref_column, - cc2.owner as ref_owner - FROM all_constraints ac - INNER JOIN all_cons_columns cc1 - ON cc1.constraint_name = ac.constraint_name - LEFT JOIN all_cons_columns cc2 - ON cc2.constraint_name = ac.r_constraint_name - AND cc2.position = cc1.position - - WHERE - ac.owner = :ownername AND ac.table_name = :tablename - - ORDER BY ac.constraint_name - '; - - $parameters = [ - ':ownername' => $schema, - ':tablename' => $table - ]; - - $results = $this->adapter->query($sql)->execute($parameters); - $isFK = false; - $name = null; - $constraints = []; - - foreach ($results as $row) { - if ($row['CONSTRAINT_NAME'] !== $name) { - $name = $row['CONSTRAINT_NAME']; - $constraints[$name] = [ - 'constraint_name' => $name, - 'constraint_type' => $this->getConstraintType($row['CONSTRAINT_TYPE']), - 'table_name' => $row['TABLE_NAME'], - ]; - - if ('C' == $row['CONSTRAINT_TYPE']) { - $constraints[$name]['CHECK_CLAUSE'] = $row['CHECK_CLAUSE']; - continue; - } - - $constraints[$name]['columns'] = []; - - $isFK = ('R' == $row['CONSTRAINT_TYPE']); - if ($isFK) { - $constraints[$name]['referenced_table_schema'] = $row['REF_OWNER']; - $constraints[$name]['referenced_table_name'] = $row['REF_TABLE']; - $constraints[$name]['referenced_columns'] = []; - $constraints[$name]['match_option'] = 'NONE'; - $constraints[$name]['update_rule'] = null; - $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; - } - } - - $constraints[$name]['columns'][] = $row['COLUMN_NAME']; - if ($isFK) { - $constraints[$name]['referenced_columns'][] = $row['REF_COLUMN']; - } - } - - return $this; - } - - /** - * {@inheritdoc} - * @see \Zend\Db\Metadata\Source\AbstractSource::loadSchemaData() - */ - protected function loadSchemaData() - { - if (isset($this->data['schemas'])) { - return; - } - - $this->prepareDataHierarchy('schemas'); - $sql = 'SELECT USERNAME FROM ALL_USERS'; - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $schemas = []; - foreach ($results->toArray() as $row) { - $schemas[] = $row['USERNAME']; - } - - $this->data['schemas'] = $schemas; - } - - /** - * {@inheritdoc} - * @see \Zend\Db\Metadata\Source\AbstractSource::loadTableNameData() - */ - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return $this; - } - - $this->prepareDataHierarchy('table_names', $schema); - $tables = []; - - // Tables - $bind = [':OWNER' => strtoupper($schema)]; - $result = $this->adapter->query('SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER=:OWNER')->execute($bind); - - foreach ($result as $row) { - $tables[$row['TABLE_NAME']] = [ - 'table_type' => 'BASE TABLE', - 'view_definition' => null, - 'check_option' => null, - 'is_updatable' => false, - ]; - } - - // Views - $result = $this->adapter->query('SELECT VIEW_NAME, TEXT FROM ALL_VIEWS WHERE OWNER=:OWNER', $bind); - foreach ($result as $row) { - $tables[$row['VIEW_NAME']] = [ - 'table_type' => 'VIEW', - 'view_definition' => null, - 'check_option' => 'NONE', - 'is_updatable' => false, - ]; - } - - $this->data['table_names'][$schema] = $tables; - return $this; - } - - /** - * FIXME: load trigger data - * - * {@inheritdoc} - * - * @see \Zend\Db\Metadata\Source\AbstractSource::loadTriggerData() - */ - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php deleted file mode 100644 index 8b43c7ef..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php +++ /dev/null @@ -1,349 +0,0 @@ -data['schemas'])) { - return; - } - $this->prepareDataHierarchy('schemas'); - - $p = $this->adapter->getPlatform(); - - $sql = 'SELECT ' . $p->quoteIdentifier('schema_name') - . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'schemata']) - . ' WHERE ' . $p->quoteIdentifier('schema_name') - . ' != \'information_schema\'' - . ' AND ' . $p->quoteIdentifier('schema_name') . " NOT LIKE 'pg_%'"; - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $schemas = []; - foreach ($results->toArray() as $row) { - $schemas[] = $row['schema_name']; - } - - $this->data['schemas'] = $schemas; - } - - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return; - } - $this->prepareDataHierarchy('table_names', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['t', 'table_name'], - ['t', 'table_type'], - ['v', 'view_definition'], - ['v', 'check_option'], - ['v', 'is_updatable'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'tables']) . ' t' - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'views']) . ' v' - . ' ON ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' = ' . $p->quoteIdentifierChain(['v', 'table_schema']) - . ' AND ' . $p->quoteIdentifierChain(['t', 'table_name']) - . ' = ' . $p->quoteIdentifierChain(['v', 'table_name']) - - . ' WHERE ' . $p->quoteIdentifierChain(['t', 'table_type']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' != \'information_schema\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $tables = []; - foreach ($results->toArray() as $row) { - $tables[$row['table_name']] = [ - 'table_type' => $row['table_type'], - 'view_definition' => $row['view_definition'], - 'check_option' => $row['check_option'], - 'is_updatable' => ('YES' == $row['is_updatable']), - ]; - } - - $this->data['table_names'][$schema] = $tables; - } - - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('columns', $schema, $table); - - $platform = $this->adapter->getPlatform(); - - $isColumns = [ - 'table_name', - 'column_name', - 'ordinal_position', - 'column_default', - 'is_nullable', - 'data_type', - 'character_maximum_length', - 'character_octet_length', - 'numeric_precision', - 'numeric_scale', - ]; - - array_walk($isColumns, function (&$c) use ($platform) { - $c = $platform->quoteIdentifier($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $platform->quoteIdentifier('information_schema') - . $platform->getIdentifierSeparator() . $platform->quoteIdentifier('columns') - . ' WHERE ' . $platform->quoteIdentifier('table_schema') - . ' != \'information\'' - . ' AND ' . $platform->quoteIdentifier('table_name') - . ' = ' . $platform->quoteTrustedValue($table); - - if ($schema != '__DEFAULT_SCHEMA__') { - $sql .= ' AND ' . $platform->quoteIdentifier('table_schema') - . ' = ' . $platform->quoteTrustedValue($schema); - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - $columns = []; - foreach ($results->toArray() as $row) { - $columns[$row['column_name']] = [ - 'ordinal_position' => $row['ordinal_position'], - 'column_default' => $row['column_default'], - 'is_nullable' => ('YES' == $row['is_nullable']), - 'data_type' => $row['data_type'], - 'character_maximum_length' => $row['character_maximum_length'], - 'character_octet_length' => $row['character_octet_length'], - 'numeric_precision' => $row['numeric_precision'], - 'numeric_scale' => $row['numeric_scale'], - 'numeric_unsigned' => null, - 'erratas' => [], - ]; - } - - $this->data['columns'][$schema][$table] = $columns; - } - - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema, $table); - - $isColumns = [ - ['t', 'table_name'], - ['tc', 'constraint_name'], - ['tc', 'constraint_type'], - ['kcu', 'column_name'], - ['cc', 'check_clause'], - ['rc', 'match_option'], - ['rc', 'update_rule'], - ['rc', 'delete_rule'], - ['referenced_table_schema' => 'kcu2', 'table_schema'], - ['referenced_table_name' => 'kcu2', 'table_name'], - ['referenced_column_name' => 'kcu2', 'column_name'], - ]; - - $p = $this->adapter->getPlatform(); - - array_walk($isColumns, function (&$c) use ($p) { - $alias = key($c); - $c = $p->quoteIdentifierChain($c); - if (is_string($alias)) { - $c .= ' ' . $p->quoteIdentifier($alias); - } - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'tables']) . ' t' - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['information_schema', 'table_constraints']) . ' tc' - . ' ON ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' = ' . $p->quoteIdentifierChain(['tc', 'table_schema']) - . ' AND ' . $p->quoteIdentifierChain(['t', 'table_name']) - . ' = ' . $p->quoteIdentifierChain(['tc', 'table_name']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'key_column_usage']) . ' kcu' - . ' ON ' . $p->quoteIdentifierChain(['tc', 'table_schema']) - . ' = ' . $p->quoteIdentifierChain(['kcu', 'table_schema']) - . ' AND ' . $p->quoteIdentifierChain(['tc', 'table_name']) - . ' = ' . $p->quoteIdentifierChain(['kcu', 'table_name']) - . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) - . ' = ' . $p->quoteIdentifierChain(['kcu', 'constraint_name']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'check_constraints']) . ' cc' - . ' ON ' . $p->quoteIdentifierChain(['tc', 'constraint_schema']) - . ' = ' . $p->quoteIdentifierChain(['cc', 'constraint_schema']) - . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) - . ' = ' . $p->quoteIdentifierChain(['cc', 'constraint_name']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'referential_constraints']) . ' rc' - . ' ON ' . $p->quoteIdentifierChain(['tc', 'constraint_schema']) - . ' = ' . $p->quoteIdentifierChain(['rc', 'constraint_schema']) - . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) - . ' = ' . $p->quoteIdentifierChain(['rc', 'constraint_name']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'key_column_usage']) . ' kcu2' - . ' ON ' . $p->quoteIdentifierChain(['rc', 'unique_constraint_schema']) - . ' = ' . $p->quoteIdentifierChain(['kcu2', 'constraint_schema']) - . ' AND ' . $p->quoteIdentifierChain(['rc', 'unique_constraint_name']) - . ' = ' . $p->quoteIdentifierChain(['kcu2', 'constraint_name']) - . ' AND ' . $p->quoteIdentifierChain(['kcu', 'position_in_unique_constraint']) - . ' = ' . $p->quoteIdentifierChain(['kcu2', 'ordinal_position']) - - . ' WHERE ' . $p->quoteIdentifierChain(['t', 'table_name']) - . ' = ' . $p->quoteTrustedValue($table) - . ' AND ' . $p->quoteIdentifierChain(['t', 'table_type']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) - . ' != \'information_schema\''; - } - - $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['tc', 'constraint_type']) - . " WHEN 'PRIMARY KEY' THEN 1" - . " WHEN 'UNIQUE' THEN 2" - . " WHEN 'FOREIGN KEY' THEN 3" - . " WHEN 'CHECK' THEN 4" - . " ELSE 5 END" - . ', ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) - . ', ' . $p->quoteIdentifierChain(['kcu', 'ordinal_position']); - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $name = null; - $constraints = []; - foreach ($results->toArray() as $row) { - if ($row['constraint_name'] !== $name) { - $name = $row['constraint_name']; - $constraints[$name] = [ - 'constraint_name' => $name, - 'constraint_type' => $row['constraint_type'], - 'table_name' => $row['table_name'], - ]; - if ('CHECK' == $row['constraint_type']) { - $constraints[$name]['check_clause'] = $row['check_clause']; - continue; - } - $constraints[$name]['columns'] = []; - $isFK = ('FOREIGN KEY' == $row['constraint_type']); - if ($isFK) { - $constraints[$name]['referenced_table_schema'] = $row['referenced_table_schema']; - $constraints[$name]['referenced_table_name'] = $row['referenced_table_name']; - $constraints[$name]['referenced_columns'] = []; - $constraints[$name]['match_option'] = $row['match_option']; - $constraints[$name]['update_rule'] = $row['update_rule']; - $constraints[$name]['delete_rule'] = $row['delete_rule']; - } - } - $constraints[$name]['columns'][] = $row['column_name']; - if ($isFK) { - $constraints[$name]['referenced_columns'][] = $row['referenced_column_name']; - } - } - - $this->data['constraints'][$schema][$table] = $constraints; - } - - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - 'trigger_name', - 'event_manipulation', - 'event_object_catalog', - 'event_object_schema', - 'event_object_table', - 'action_order', - 'action_condition', - 'action_statement', - 'action_orientation', - ['action_timing' => 'condition_timing'], - ['action_reference_old_table' => 'condition_reference_old_table'], - ['action_reference_new_table' => 'condition_reference_new_table'], - 'created', - ]; - - array_walk($isColumns, function (&$c) use ($p) { - if (is_array($c)) { - $alias = key($c); - $c = $p->quoteIdentifierChain($c); - if (is_string($alias)) { - $c .= ' ' . $p->quoteIdentifier($alias); - } - } else { - $c = $p->quoteIdentifier($c); - } - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'triggers']) - . ' WHERE '; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= $p->quoteIdentifier('trigger_schema') - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= $p->quoteIdentifier('trigger_schema') - . ' != \'information_schema\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $row = array_change_key_case($row, CASE_LOWER); - $row['action_reference_old_row'] = 'OLD'; - $row['action_reference_new_row'] = 'NEW'; - if (null !== $row['created']) { - $row['created'] = new \DateTime($row['created']); - } - $data[$row['trigger_name']] = $row; - } - - $this->data['triggers'][$schema] = $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php deleted file mode 100644 index 9cdad7f8..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php +++ /dev/null @@ -1,345 +0,0 @@ -data['schemas'])) { - return; - } - $this->prepareDataHierarchy('schemas'); - - $p = $this->adapter->getPlatform(); - - $sql = 'SELECT ' . $p->quoteIdentifier('SCHEMA_NAME') - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'SCHEMATA']) - . ' WHERE ' . $p->quoteIdentifier('SCHEMA_NAME') - . ' != \'INFORMATION_SCHEMA\''; - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $schemas = []; - foreach ($results->toArray() as $row) { - $schemas[] = $row['SCHEMA_NAME']; - } - - $this->data['schemas'] = $schemas; - } - - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return; - } - $this->prepareDataHierarchy('table_names', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['T', 'TABLE_NAME'], - ['T', 'TABLE_TYPE'], - ['V', 'VIEW_DEFINITION'], - ['V', 'CHECK_OPTION'], - ['V', 'IS_UPDATABLE'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' t' - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'VIEWS']) . ' v' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_NAME']) - - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $tables = []; - foreach ($results->toArray() as $row) { - $tables[$row['TABLE_NAME']] = [ - 'table_type' => $row['TABLE_TYPE'], - 'view_definition' => $row['VIEW_DEFINITION'], - 'check_option' => $row['CHECK_OPTION'], - 'is_updatable' => ('YES' == $row['IS_UPDATABLE']), - ]; - } - - $this->data['table_names'][$schema] = $tables; - } - - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - $this->prepareDataHierarchy('columns', $schema, $table); - $p = $this->adapter->getPlatform(); - - $isColumns = [ - ['C', 'ORDINAL_POSITION'], - ['C', 'COLUMN_DEFAULT'], - ['C', 'IS_NULLABLE'], - ['C', 'DATA_TYPE'], - ['C', 'CHARACTER_MAXIMUM_LENGTH'], - ['C', 'CHARACTER_OCTET_LENGTH'], - ['C', 'NUMERIC_PRECISION'], - ['C', 'NUMERIC_SCALE'], - ['C', 'COLUMN_NAME'], - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifierChain($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'COLUMNS']) . 'C' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_NAME']) - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')' - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteTrustedValue($table); - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - $columns = []; - foreach ($results->toArray() as $row) { - $columns[$row['COLUMN_NAME']] = [ - 'ordinal_position' => $row['ORDINAL_POSITION'], - 'column_default' => $row['COLUMN_DEFAULT'], - 'is_nullable' => ('YES' == $row['IS_NULLABLE']), - 'data_type' => $row['DATA_TYPE'], - 'character_maximum_length' => $row['CHARACTER_MAXIMUM_LENGTH'], - 'character_octet_length' => $row['CHARACTER_OCTET_LENGTH'], - 'numeric_precision' => $row['NUMERIC_PRECISION'], - 'numeric_scale' => $row['NUMERIC_SCALE'], - 'numeric_unsigned' => null, - 'erratas' => [], - ]; - } - - $this->data['columns'][$schema][$table] = $columns; - } - - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema, $table); - - $isColumns = [ - ['T', 'TABLE_NAME'], - ['TC', 'CONSTRAINT_NAME'], - ['TC', 'CONSTRAINT_TYPE'], - ['KCU', 'COLUMN_NAME'], - ['CC', 'CHECK_CLAUSE'], - ['RC', 'MATCH_OPTION'], - ['RC', 'UPDATE_RULE'], - ['RC', 'DELETE_RULE'], - ['REFERENCED_TABLE_SCHEMA' => 'KCU2', 'TABLE_SCHEMA'], - ['REFERENCED_TABLE_NAME' => 'KCU2', 'TABLE_NAME'], - ['REFERENCED_COLUMN_NAME' => 'KCU2', 'COLUMN_NAME'], - ]; - - $p = $this->adapter->getPlatform(); - - array_walk($isColumns, function (&$c) use ($p) { - $alias = key($c); - $c = $p->quoteIdentifierChain($c); - if (is_string($alias)) { - $c .= ' ' . $p->quoteIdentifier($alias); - } - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' T' - - . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . ' TC' - . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU' - . ' ON ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'CHECK_CONSTRAINTS']) . ' CC' - . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['CC', 'CONSTRAINT_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['CC', 'CONSTRAINT_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . ' RC' - . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) - - . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU2' - . ' ON ' . $p->quoteIdentifierChain(['RC', 'UNIQUE_CONSTRAINT_SCHEMA']) - . ' = ' . $p->quoteIdentifierChain(['KCU2', 'CONSTRAINT_SCHEMA']) - . ' AND ' . $p->quoteIdentifierChain(['RC', 'UNIQUE_CONSTRAINT_NAME']) - . ' = ' . $p->quoteIdentifierChain(['KCU2', 'CONSTRAINT_NAME']) - . ' AND ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']) - . ' = ' . $p->quoteIdentifierChain(['KCU2', 'ORDINAL_POSITION']) - - . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) - . ' = ' . $p->quoteTrustedValue($table) - . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) - . ' IN (\'BASE TABLE\', \'VIEW\')'; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) - . ' != \'INFORMATION_SCHEMA\''; - } - - $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_TYPE']) - . " WHEN 'PRIMARY KEY' THEN 1" - . " WHEN 'UNIQUE' THEN 2" - . " WHEN 'FOREIGN KEY' THEN 3" - . " WHEN 'CHECK' THEN 4" - . " ELSE 5 END" - . ', ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) - . ', ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']); - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $name = null; - $constraints = []; - $isFK = false; - foreach ($results->toArray() as $row) { - if ($row['CONSTRAINT_NAME'] !== $name) { - $name = $row['CONSTRAINT_NAME']; - $constraints[$name] = [ - 'constraint_name' => $name, - 'constraint_type' => $row['CONSTRAINT_TYPE'], - 'table_name' => $row['TABLE_NAME'], - ]; - if ('CHECK' == $row['CONSTRAINT_TYPE']) { - $constraints[$name]['check_clause'] = $row['CHECK_CLAUSE']; - continue; - } - $constraints[$name]['columns'] = []; - $isFK = ('FOREIGN KEY' == $row['CONSTRAINT_TYPE']); - if ($isFK) { - $constraints[$name]['referenced_table_schema'] = $row['REFERENCED_TABLE_SCHEMA']; - $constraints[$name]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME']; - $constraints[$name]['referenced_columns'] = []; - $constraints[$name]['match_option'] = $row['MATCH_OPTION']; - $constraints[$name]['update_rule'] = $row['UPDATE_RULE']; - $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; - } - } - $constraints[$name]['columns'][] = $row['COLUMN_NAME']; - if ($isFK) { - $constraints[$name]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; - } - } - - $this->data['constraints'][$schema][$table] = $constraints; - } - - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - - $p = $this->adapter->getPlatform(); - - $isColumns = [ - 'TRIGGER_NAME', - 'EVENT_MANIPULATION', - 'EVENT_OBJECT_CATALOG', - 'EVENT_OBJECT_SCHEMA', - 'EVENT_OBJECT_TABLE', - 'ACTION_ORDER', - 'ACTION_CONDITION', - 'ACTION_STATEMENT', - 'ACTION_ORIENTATION', - 'ACTION_TIMING', - 'ACTION_REFERENCE_OLD_TABLE', - 'ACTION_REFERENCE_NEW_TABLE', - 'ACTION_REFERENCE_OLD_ROW', - 'ACTION_REFERENCE_NEW_ROW', - 'CREATED', - ]; - - array_walk($isColumns, function (&$c) use ($p) { - $c = $p->quoteIdentifier($c); - }); - - $sql = 'SELECT ' . implode(', ', $isColumns) - . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TRIGGERS']) - . ' WHERE '; - - if ($schema != self::DEFAULT_SCHEMA) { - $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') - . ' = ' . $p->quoteTrustedValue($schema); - } else { - $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') - . ' != \'INFORMATION_SCHEMA\''; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - - $data = []; - foreach ($results->toArray() as $row) { - $row = array_change_key_case($row, CASE_LOWER); - if (null !== $row['created']) { - $row['created'] = new \DateTime($row['created']); - } - $data[$row['trigger_name']] = $row; - } - - $this->data['triggers'][$schema] = $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php b/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php deleted file mode 100644 index b189c3b2..00000000 --- a/bundled-libs/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php +++ /dev/null @@ -1,387 +0,0 @@ -data['schemas'])) { - return; - } - $this->prepareDataHierarchy('schemas'); - - $results = $this->fetchPragma('database_list'); - foreach ($results as $row) { - $schemas[] = $row['name']; - } - $this->data['schemas'] = $schemas; - } - - protected function loadTableNameData($schema) - { - if (isset($this->data['table_names'][$schema])) { - return; - } - $this->prepareDataHierarchy('table_names', $schema); - - // FEATURE: Filename? - - $p = $this->adapter->getPlatform(); - - $sql = 'SELECT "name", "type", "sql" FROM ' . $p->quoteIdentifierChain([$schema, 'sqlite_master']) - . ' WHERE "type" IN (\'table\',\'view\') AND "name" NOT LIKE \'sqlite_%\''; - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - $tables = []; - foreach ($results->toArray() as $row) { - if ('table' == $row['type']) { - $table = [ - 'table_type' => 'BASE TABLE', - 'view_definition' => null, // VIEW only - 'check_option' => null, // VIEW only - 'is_updatable' => null, // VIEW only - ]; - } else { - $table = [ - 'table_type' => 'VIEW', - 'view_definition' => null, - 'check_option' => 'NONE', - 'is_updatable' => false, - ]; - - // Parse out extra data - if (null !== ($data = $this->parseView($row['sql']))) { - $table = array_merge($table, $data); - } - } - $tables[$row['name']] = $table; - } - $this->data['table_names'][$schema] = $tables; - } - - protected function loadColumnData($table, $schema) - { - if (isset($this->data['columns'][$schema][$table])) { - return; - } - $this->prepareDataHierarchy('columns', $schema, $table); - $this->prepareDataHierarchy('sqlite_columns', $schema, $table); - - $results = $this->fetchPragma('table_info', $table, $schema); - - $columns = []; - - foreach ($results as $row) { - $columns[$row['name']] = [ - // cid appears to be zero-based, ordinal position needs to be one-based - 'ordinal_position' => $row['cid'] + 1, - 'column_default' => $row['dflt_value'], - 'is_nullable' => ! ((bool) $row['notnull']), - 'data_type' => $row['type'], - 'character_maximum_length' => null, - 'character_octet_length' => null, - 'numeric_precision' => null, - 'numeric_scale' => null, - 'numeric_unsigned' => null, - 'erratas' => [], - ]; - // TODO: populate character_ and numeric_values with correct info - } - - $this->data['columns'][$schema][$table] = $columns; - $this->data['sqlite_columns'][$schema][$table] = $results; - } - - protected function loadConstraintData($table, $schema) - { - if (isset($this->data['constraints'][$schema][$table])) { - return; - } - - $this->prepareDataHierarchy('constraints', $schema, $table); - - $this->loadColumnData($table, $schema); - $primaryKey = []; - - foreach ($this->data['sqlite_columns'][$schema][$table] as $col) { - if ((bool) $col['pk']) { - $primaryKey[] = $col['name']; - } - } - - if (empty($primaryKey)) { - $primaryKey = null; - } - $constraints = []; - $indexes = $this->fetchPragma('index_list', $table, $schema); - foreach ($indexes as $index) { - if (! ((bool) $index['unique'])) { - continue; - } - $constraint = [ - 'constraint_name' => $index['name'], - 'constraint_type' => 'UNIQUE', - 'table_name' => $table, - 'columns' => [], - ]; - - $info = $this->fetchPragma('index_info', $index['name'], $schema); - - foreach ($info as $column) { - $constraint['columns'][] = $column['name']; - } - if ($primaryKey === $constraint['columns']) { - $constraint['constraint_type'] = 'PRIMARY KEY'; - $primaryKey = null; - } - $constraints[$constraint['constraint_name']] = $constraint; - } - - if (null !== $primaryKey) { - $constraintName = '_zf_' . $table . '_PRIMARY'; - $constraints[$constraintName] = [ - 'constraint_name' => $constraintName, - 'constraint_type' => 'PRIMARY KEY', - 'table_name' => $table, - 'columns' => $primaryKey, - ]; - } - - $foreignKeys = $this->fetchPragma('foreign_key_list', $table, $schema); - - $id = $name = null; - foreach ($foreignKeys as $fk) { - if ($id !== $fk['id']) { - $id = $fk['id']; - $name = '_zf_' . $table . '_FOREIGN_KEY_' . ($id + 1); - $constraints[$name] = [ - 'constraint_name' => $name, - 'constraint_type' => 'FOREIGN KEY', - 'table_name' => $table, - 'columns' => [], - 'referenced_table_schema' => $schema, - 'referenced_table_name' => $fk['table'], - 'referenced_columns' => [], - // TODO: Verify match, on_update, and on_delete values conform to SQL Standard - 'match_option' => strtoupper($fk['match']), - 'update_rule' => strtoupper($fk['on_update']), - 'delete_rule' => strtoupper($fk['on_delete']), - ]; - } - $constraints[$name]['columns'][] = $fk['from']; - $constraints[$name]['referenced_columns'][] = $fk['to']; - } - - $this->data['constraints'][$schema][$table] = $constraints; - } - - protected function loadTriggerData($schema) - { - if (isset($this->data['triggers'][$schema])) { - return; - } - - $this->prepareDataHierarchy('triggers', $schema); - - $p = $this->adapter->getPlatform(); - - $sql = 'SELECT "name", "tbl_name", "sql" FROM ' - . $p->quoteIdentifierChain([$schema, 'sqlite_master']) - . ' WHERE "type" = \'trigger\''; - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - $triggers = []; - foreach ($results->toArray() as $row) { - $trigger = [ - 'trigger_name' => $row['name'], - 'event_manipulation' => null, // in $row['sql'] - 'event_object_catalog' => null, - 'event_object_schema' => $schema, - 'event_object_table' => $row['tbl_name'], - 'action_order' => 0, - 'action_condition' => null, // in $row['sql'] - 'action_statement' => null, // in $row['sql'] - 'action_orientation' => 'ROW', - 'action_timing' => null, // in $row['sql'] - 'action_reference_old_table' => null, - 'action_reference_new_table' => null, - 'action_reference_old_row' => 'OLD', - 'action_reference_new_row' => 'NEW', - 'created' => null, - ]; - - // Parse out extra data - if (null !== ($data = $this->parseTrigger($row['sql']))) { - $trigger = array_merge($trigger, $data); - } - $triggers[$trigger['trigger_name']] = $trigger; - } - - $this->data['triggers'][$schema] = $triggers; - } - - protected function fetchPragma($name, $value = null, $schema = null) - { - $p = $this->adapter->getPlatform(); - - $sql = 'PRAGMA '; - - if (null !== $schema) { - $sql .= $p->quoteIdentifier($schema) . '.'; - } - $sql .= $name; - - if (null !== $value) { - $sql .= '(' . $p->quoteTrustedValue($value) . ')'; - } - - $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - if ($results instanceof ResultSetInterface) { - return $results->toArray(); - } - return []; - } - - protected function parseView($sql) - { - static $re = null; - if (null === $re) { - $identifierChain = $this->getIdentifierChainRegularExpression(); - $re = $this->buildRegularExpression([ - 'CREATE', - ['TEMP|TEMPORARY'], - 'VIEW', - ['IF', 'NOT', 'EXISTS'], - $identifierChain, - 'AS', - '(?.+)', - [';'], - ]); - } - - if (! preg_match($re, $sql, $matches)) { - return; - } - return [ - 'view_definition' => $matches['view_definition'], - ]; - } - - protected function parseTrigger($sql) - { - static $re = null; - if (null === $re) { - $identifier = $this->getIdentifierRegularExpression(); - $identifierList = $this->getIdentifierListRegularExpression(); - $identifierChain = $this->getIdentifierChainRegularExpression(); - $re = $this->buildRegularExpression([ - 'CREATE', - ['TEMP|TEMPORARY'], - 'TRIGGER', - ['IF', 'NOT', 'EXISTS'], - $identifierChain, - ['(?BEFORE|AFTER|INSTEAD\\s+OF)', ], - '(?DELETE|INSERT|UPDATE)', - ['OF', '(?' . $identifierList . ')'], - 'ON', - '(?' . $identifier . ')', - ['FOR', 'EACH', 'ROW'], - ['WHEN', '(?.+)'], - '(?BEGIN', - '.+', - 'END)', - [';'], - ]); - } - - if (! preg_match($re, $sql, $matches)) { - return; - } - $data = []; - - foreach ($matches as $key => $value) { - if (is_string($key)) { - $data[$key] = $value; - } - } - - // Normalize data and populate defaults, if necessary - - $data['event_manipulation'] = strtoupper($data['event_manipulation']); - if (empty($data['action_condition'])) { - $data['action_condition'] = null; - } - if (! empty($data['action_timing'])) { - $data['action_timing'] = strtoupper($data['action_timing']); - if ('I' == $data['action_timing'][0]) { - // normalize the white-space between the two words - $data['action_timing'] = 'INSTEAD OF'; - } - } else { - $data['action_timing'] = 'AFTER'; - } - unset($data['column_usage']); - - return $data; - } - - protected function buildRegularExpression(array $re) - { - foreach ($re as &$value) { - if (is_array($value)) { - $value = '(?:' . implode('\\s*+', $value) . '\\s*+)?'; - } else { - $value .= '\\s*+'; - } - } - unset($value); - $re = '/^' . implode('\\s*+', $re) . '$/'; - return $re; - } - - protected function getIdentifierRegularExpression() - { - static $re = null; - if (null === $re) { - $re = '(?:' . implode('|', [ - '"(?:[^"\\\\]++|\\\\.)*+"', - '`(?:[^`]++|``)*+`', - '\\[[^\\]]+\\]', - '[^\\s\\.]+', - ]) . ')'; - } - - return $re; - } - - protected function getIdentifierChainRegularExpression() - { - static $re = null; - if (null === $re) { - $identifier = $this->getIdentifierRegularExpression(); - $re = $identifier . '(?:\\s*\\.\\s*' . $identifier . ')*+'; - } - return $re; - } - - protected function getIdentifierListRegularExpression() - { - static $re = null; - if (null === $re) { - $identifier = $this->getIdentifierRegularExpression(); - $re = $identifier . '(?:\\s*,\\s*' . $identifier . ')*+'; - } - return $re; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Module.php b/bundled-libs/zendframework/zend-db/src/Module.php deleted file mode 100644 index 498c7dbf..00000000 --- a/bundled-libs/zendframework/zend-db/src/Module.php +++ /dev/null @@ -1,24 +0,0 @@ - $provider->getDependencyConfig(), - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/ResultSet/AbstractResultSet.php b/bundled-libs/zendframework/zend-db/src/ResultSet/AbstractResultSet.php deleted file mode 100644 index 912902ab..00000000 --- a/bundled-libs/zendframework/zend-db/src/ResultSet/AbstractResultSet.php +++ /dev/null @@ -1,291 +0,0 @@ -buffer)) { - $this->buffer = []; - } - - if ($dataSource instanceof ResultInterface) { - $this->fieldCount = $dataSource->getFieldCount(); - $this->dataSource = $dataSource; - if ($dataSource->isBuffered()) { - $this->buffer = -1; - } - if (is_array($this->buffer)) { - $this->dataSource->rewind(); - } - return $this; - } - - if (is_array($dataSource)) { - // its safe to get numbers from an array - $first = current($dataSource); - reset($dataSource); - $this->fieldCount = $first === false ? 0 : count($first); - $this->dataSource = new ArrayIterator($dataSource); - $this->buffer = -1; // array's are a natural buffer - } elseif ($dataSource instanceof IteratorAggregate) { - $this->dataSource = $dataSource->getIterator(); - } elseif ($dataSource instanceof Iterator) { - $this->dataSource = $dataSource; - } else { - throw new Exception\InvalidArgumentException( - 'DataSource provided is not an array, nor does it implement Iterator or IteratorAggregate' - ); - } - - return $this; - } - - /** - * @return self Provides a fluent interface - * @throws Exception\RuntimeException - */ - public function buffer() - { - if ($this->buffer === -2) { - throw new Exception\RuntimeException('Buffering must be enabled before iteration is started'); - } elseif ($this->buffer === null) { - $this->buffer = []; - if ($this->dataSource instanceof ResultInterface) { - $this->dataSource->rewind(); - } - } - return $this; - } - - public function isBuffered() - { - if ($this->buffer === -1 || is_array($this->buffer)) { - return true; - } - return false; - } - - /** - * Get the data source used to create the result set - * - * @return null|Iterator - */ - public function getDataSource() - { - return $this->dataSource; - } - - /** - * Retrieve count of fields in individual rows of the result set - * - * @return int - */ - public function getFieldCount() - { - if (null !== $this->fieldCount) { - return $this->fieldCount; - } - - $dataSource = $this->getDataSource(); - if (null === $dataSource) { - return 0; - } - - $dataSource->rewind(); - if (! $dataSource->valid()) { - $this->fieldCount = 0; - return 0; - } - - $row = $dataSource->current(); - if (is_object($row) && $row instanceof Countable) { - $this->fieldCount = $row->count(); - return $this->fieldCount; - } - - $row = (array) $row; - $this->fieldCount = count($row); - return $this->fieldCount; - } - - /** - * Iterator: move pointer to next item - * - * @return void - */ - public function next() - { - if ($this->buffer === null) { - $this->buffer = -2; // implicitly disable buffering from here on - } - if (! is_array($this->buffer) || $this->position == $this->dataSource->key()) { - $this->dataSource->next(); - } - $this->position++; - } - - /** - * Iterator: retrieve current key - * - * @return mixed - */ - public function key() - { - return $this->position; - } - - /** - * Iterator: get current item - * - * @return array|null - */ - public function current() - { - if (-1 === $this->buffer) { - // datasource was an array when the resultset was initialized - return $this->dataSource->current(); - } - - if ($this->buffer === null) { - $this->buffer = -2; // implicitly disable buffering from here on - } elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) { - return $this->buffer[$this->position]; - } - $data = $this->dataSource->current(); - if (is_array($this->buffer)) { - $this->buffer[$this->position] = $data; - } - return is_array($data) ? $data : null; - } - - /** - * Iterator: is pointer valid? - * - * @return bool - */ - public function valid() - { - if (is_array($this->buffer) && isset($this->buffer[$this->position])) { - return true; - } - if ($this->dataSource instanceof Iterator) { - return $this->dataSource->valid(); - } else { - $key = key($this->dataSource); - return ($key !== null); - } - } - - /** - * Iterator: rewind - * - * @return void - */ - public function rewind() - { - if (! is_array($this->buffer)) { - if ($this->dataSource instanceof Iterator) { - $this->dataSource->rewind(); - } else { - reset($this->dataSource); - } - } - $this->position = 0; - } - - /** - * Countable: return count of rows - * - * @return int - */ - public function count() - { - if ($this->count !== null) { - return $this->count; - } - - if ($this->dataSource instanceof Countable) { - $this->count = count($this->dataSource); - } - - return $this->count; - } - - /** - * Cast result set to array of arrays - * - * @return array - * @throws Exception\RuntimeException if any row is not castable to an array - */ - public function toArray() - { - $return = []; - foreach ($this as $row) { - if (is_array($row)) { - $return[] = $row; - } elseif (method_exists($row, 'toArray')) { - $return[] = $row->toArray(); - } elseif (method_exists($row, 'getArrayCopy')) { - $return[] = $row->getArrayCopy(); - } else { - throw new Exception\RuntimeException( - 'Rows as part of this DataSource, with type ' . gettype($row) . ' cannot be cast to an array' - ); - } - } - return $return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php b/bundled-libs/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php deleted file mode 100644 index 646aec4c..00000000 --- a/bundled-libs/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -setHydrator($hydrator ?: new $defaultHydratorClass()); - $this->setObjectPrototype(($objectPrototype) ?: new ArrayObject); - } - - /** - * Set the row object prototype - * - * @param object $objectPrototype - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setObjectPrototype($objectPrototype) - { - if (! is_object($objectPrototype)) { - throw new Exception\InvalidArgumentException( - 'An object must be set as the object prototype, a ' . gettype($objectPrototype) . ' was provided.' - ); - } - $this->objectPrototype = $objectPrototype; - return $this; - } - - /** - * Get the row object prototype - * - * @return object - */ - public function getObjectPrototype() - { - return $this->objectPrototype; - } - - /** - * Set the hydrator to use for each row object - * - * @param HydratorInterface $hydrator - * @return self Provides a fluent interface - */ - public function setHydrator(HydratorInterface $hydrator) - { - $this->hydrator = $hydrator; - return $this; - } - - /** - * Get the hydrator to use for each row object - * - * @return HydratorInterface - */ - public function getHydrator() - { - return $this->hydrator; - } - - /** - * Iterator: get current item - * - * @return object - */ - public function current() - { - if ($this->buffer === null) { - $this->buffer = -2; // implicitly disable buffering from here on - } elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) { - return $this->buffer[$this->position]; - } - $data = $this->dataSource->current(); - $object = is_array($data) ? $this->hydrator->hydrate($data, clone $this->objectPrototype) : false; - - if (is_array($this->buffer)) { - $this->buffer[$this->position] = $object; - } - - return $object; - } - - /** - * Cast result set to array of arrays - * - * @return array - * @throws Exception\RuntimeException if any row is not castable to an array - */ - public function toArray() - { - $return = []; - foreach ($this as $row) { - $return[] = $this->hydrator->extract($row); - } - return $return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSet.php b/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSet.php deleted file mode 100644 index ebbb455c..00000000 --- a/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSet.php +++ /dev/null @@ -1,120 +0,0 @@ -returnType = $returnType; - } else { - $this->returnType = self::TYPE_ARRAYOBJECT; - } - if ($this->returnType === self::TYPE_ARRAYOBJECT) { - $this->setArrayObjectPrototype(($arrayObjectPrototype) ?: new ArrayObject([], ArrayObject::ARRAY_AS_PROPS)); - } - } - - /** - * Set the row object prototype - * - * @param ArrayObject $arrayObjectPrototype - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setArrayObjectPrototype($arrayObjectPrototype) - { - if (! is_object($arrayObjectPrototype) - || ( - ! $arrayObjectPrototype instanceof ArrayObject - && ! method_exists($arrayObjectPrototype, 'exchangeArray') - ) - ) { - throw new Exception\InvalidArgumentException( - 'Object must be of type ArrayObject, or at least implement exchangeArray' - ); - } - $this->arrayObjectPrototype = $arrayObjectPrototype; - return $this; - } - - /** - * Get the row object prototype - * - * @return ArrayObject - */ - public function getArrayObjectPrototype() - { - return $this->arrayObjectPrototype; - } - - /** - * Get the return type to use when returning objects from the set - * - * @return string - */ - public function getReturnType() - { - return $this->returnType; - } - - /** - * @return array|\ArrayObject|null - */ - public function current() - { - $data = parent::current(); - - if ($this->returnType === self::TYPE_ARRAYOBJECT && is_array($data)) { - /** @var $ao ArrayObject */ - $ao = clone $this->arrayObjectPrototype; - if ($ao instanceof ArrayObject || method_exists($ao, 'exchangeArray')) { - $ao->exchangeArray($data); - } - return $ao; - } - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSetInterface.php b/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSetInterface.php deleted file mode 100644 index 5891dbfc..00000000 --- a/bundled-libs/zendframework/zend-db/src/ResultSet/ResultSetInterface.php +++ /dev/null @@ -1,33 +0,0 @@ -isInitialized) { - return; - } - - if (! $this->featureSet instanceof Feature\FeatureSet) { - $this->featureSet = new Feature\FeatureSet; - } - - $this->featureSet->setRowGateway($this); - $this->featureSet->apply('preInitialize', []); - - if (! is_string($this->table) && ! $this->table instanceof TableIdentifier) { - throw new Exception\RuntimeException('This row object does not have a valid table set.'); - } - - if ($this->primaryKeyColumn === null) { - throw new Exception\RuntimeException('This row object does not have a primary key column set.'); - } elseif (is_string($this->primaryKeyColumn)) { - $this->primaryKeyColumn = (array) $this->primaryKeyColumn; - } - - if (! $this->sql instanceof Sql) { - throw new Exception\RuntimeException('This row object does not have a Sql object set.'); - } - - $this->featureSet->apply('postInitialize', []); - - $this->isInitialized = true; - } - - /** - * Populate Data - * - * @param array $rowData - * @param bool $rowExistsInDatabase - * @return self Provides a fluent interface - */ - public function populate(array $rowData, $rowExistsInDatabase = false) - { - $this->initialize(); - - $this->data = $rowData; - if ($rowExistsInDatabase == true) { - $this->processPrimaryKeyData(); - } else { - $this->primaryKeyData = null; - } - - return $this; - } - - /** - * @param mixed $array - * @return AbstractRowGateway - */ - public function exchangeArray($array) - { - return $this->populate($array, true); - } - - /** - * Save - * - * @return int - */ - public function save() - { - $this->initialize(); - - if ($this->rowExistsInDatabase()) { - // UPDATE - - $data = $this->data; - $where = []; - $isPkModified = false; - - // primary key is always an array even if its a single column - foreach ($this->primaryKeyColumn as $pkColumn) { - $where[$pkColumn] = $this->primaryKeyData[$pkColumn]; - if ($data[$pkColumn] == $this->primaryKeyData[$pkColumn]) { - unset($data[$pkColumn]); - } else { - $isPkModified = true; - } - } - - $statement = $this->sql->prepareStatementForSqlObject($this->sql->update()->set($data)->where($where)); - $result = $statement->execute(); - $rowsAffected = $result->getAffectedRows(); - unset($statement, $result); // cleanup - - // If one or more primary keys are modified, we update the where clause - if ($isPkModified) { - foreach ($this->primaryKeyColumn as $pkColumn) { - if ($data[$pkColumn] != $this->primaryKeyData[$pkColumn]) { - $where[$pkColumn] = $data[$pkColumn]; - } - } - } - } else { - // INSERT - $insert = $this->sql->insert(); - $insert->values($this->data); - - $statement = $this->sql->prepareStatementForSqlObject($insert); - - $result = $statement->execute(); - if (($primaryKeyValue = $result->getGeneratedValue()) && count($this->primaryKeyColumn) == 1) { - $this->primaryKeyData = [$this->primaryKeyColumn[0] => $primaryKeyValue]; - } else { - // make primary key data available so that $where can be complete - $this->processPrimaryKeyData(); - } - $rowsAffected = $result->getAffectedRows(); - unset($statement, $result); // cleanup - - $where = []; - // primary key is always an array even if its a single column - foreach ($this->primaryKeyColumn as $pkColumn) { - $where[$pkColumn] = $this->primaryKeyData[$pkColumn]; - } - } - - // refresh data - $statement = $this->sql->prepareStatementForSqlObject($this->sql->select()->where($where)); - $result = $statement->execute(); - $rowData = $result->current(); - unset($statement, $result); // cleanup - - // make sure data and original data are in sync after save - $this->populate($rowData, true); - - // return rows affected - return $rowsAffected; - } - - /** - * Delete - * - * @return int - */ - public function delete() - { - $this->initialize(); - - $where = []; - // primary key is always an array even if its a single column - foreach ($this->primaryKeyColumn as $pkColumn) { - $where[$pkColumn] = $this->primaryKeyData[$pkColumn]; - } - - // @todo determine if we need to do a select to ensure 1 row will be affected - - $statement = $this->sql->prepareStatementForSqlObject($this->sql->delete()->where($where)); - $result = $statement->execute(); - - $affectedRows = $result->getAffectedRows(); - if ($affectedRows == 1) { - // detach from database - $this->primaryKeyData = null; - } - - return $affectedRows; - } - - /** - * Offset Exists - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset) - { - return array_key_exists($offset, $this->data); - } - - /** - * Offset get - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->data[$offset]; - } - - /** - * Offset set - * - * @param string $offset - * @param mixed $value - * @return self Provides a fluent interface - */ - public function offsetSet($offset, $value) - { - $this->data[$offset] = $value; - return $this; - } - - /** - * Offset unset - * - * @param string $offset - * @return self Provides a fluent interface - */ - public function offsetUnset($offset) - { - $this->data[$offset] = null; - return $this; - } - - /** - * @return int - */ - public function count() - { - return count($this->data); - } - - /** - * To array - * - * @return array - */ - public function toArray() - { - return $this->data; - } - - /** - * __get - * - * @param string $name - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function __get($name) - { - if (array_key_exists($name, $this->data)) { - return $this->data[$name]; - } else { - throw new Exception\InvalidArgumentException('Not a valid column in this row: ' . $name); - } - } - - /** - * __set - * - * @param string $name - * @param mixed $value - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * __isset - * - * @param string $name - * @return bool - */ - public function __isset($name) - { - return $this->offsetExists($name); - } - - /** - * __unset - * - * @param string $name - * @return void - */ - public function __unset($name) - { - $this->offsetUnset($name); - } - - /** - * @return bool - */ - public function rowExistsInDatabase() - { - return ($this->primaryKeyData !== null); - } - - /** - * @throws Exception\RuntimeException - */ - protected function processPrimaryKeyData() - { - $this->primaryKeyData = []; - foreach ($this->primaryKeyColumn as $column) { - if (! isset($this->data[$column])) { - throw new Exception\RuntimeException( - 'While processing primary key data, a known key ' . $column . ' was not found in the data array' - ); - } - $this->primaryKeyData[$column] = $this->data[$column]; - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php b/bundled-libs/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php deleted file mode 100644 index b3d11b4a..00000000 --- a/bundled-libs/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -rowGateway = $rowGateway; - } - - /** - * @throws \Zend\Db\RowGateway\Exception\RuntimeException - */ - public function initialize() - { - throw new Exception\RuntimeException('This method is not intended to be called on this object.'); - } - - /** - * @return array - */ - public function getMagicMethodSpecifications() - { - return []; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php b/bundled-libs/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php deleted file mode 100644 index f3c36a07..00000000 --- a/bundled-libs/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php +++ /dev/null @@ -1,161 +0,0 @@ -addFeatures($features); - } - } - - /** - * @param AbstractRowGateway $rowGateway - * @return self Provides a fluent interface - */ - public function setRowGateway(AbstractRowGateway $rowGateway) - { - $this->rowGateway = $rowGateway; - foreach ($this->features as $feature) { - $feature->setRowGateway($this->rowGateway); - } - return $this; - } - - public function getFeatureByClassName($featureClassName) - { - $feature = false; - foreach ($this->features as $potentialFeature) { - if ($potentialFeature instanceof $featureClassName) { - $feature = $potentialFeature; - break; - } - } - return $feature; - } - - /** - * @param array $features - * @return self Provides a fluent interface - */ - public function addFeatures(array $features) - { - foreach ($features as $feature) { - $this->addFeature($feature); - } - return $this; - } - - /** - * @param AbstractFeature $feature - * @return self Provides a fluent interface - */ - public function addFeature(AbstractFeature $feature) - { - $this->features[] = $feature; - $feature->setRowGateway($feature); - return $this; - } - - public function apply($method, $args) - { - foreach ($this->features as $feature) { - if (method_exists($feature, $method)) { - $return = call_user_func_array([$feature, $method], $args); - if ($return === self::APPLY_HALT) { - break; - } - } - } - } - - /** - * @param string $property - * @return bool - */ - public function canCallMagicGet($property) - { - return false; - } - - /** - * @param string $property - * @return mixed - */ - public function callMagicGet($property) - { - $return = null; - return $return; - } - - /** - * @param string $property - * @return bool - */ - public function canCallMagicSet($property) - { - return false; - } - - /** - * @param $property - * @param $value - * @return mixed - */ - public function callMagicSet($property, $value) - { - $return = null; - return $return; - } - - /** - * @param string $method - * @return bool - */ - public function canCallMagicCall($method) - { - return false; - } - - /** - * @param string $method - * @param array $arguments - * @return mixed - */ - public function callMagicCall($method, $arguments) - { - $return = null; - return $return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/RowGateway/RowGateway.php b/bundled-libs/zendframework/zend-db/src/RowGateway/RowGateway.php deleted file mode 100644 index 2248538e..00000000 --- a/bundled-libs/zendframework/zend-db/src/RowGateway/RowGateway.php +++ /dev/null @@ -1,50 +0,0 @@ -primaryKeyColumn = empty($primaryKeyColumn) ? null : (array) $primaryKeyColumn; - - // set table - $this->table = $table; - - // set Sql object - if ($adapterOrSql instanceof Sql) { - $this->sql = $adapterOrSql; - } elseif ($adapterOrSql instanceof Adapter) { - $this->sql = new Sql($adapterOrSql, $this->table); - } else { - throw new Exception\InvalidArgumentException('A valid Sql object was not provided.'); - } - - if ($this->sql->getTable() !== $this->table) { - throw new Exception\InvalidArgumentException( - 'The Sql object provided does not have a table that matches this row object' - ); - } - - $this->initialize(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php b/bundled-libs/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php deleted file mode 100644 index b623c4ed..00000000 --- a/bundled-libs/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -buildNormalizedArgument($argument, self::TYPE_VALUE); - } - - if (is_scalar($argument) || $argument === null) { - return $this->buildNormalizedArgument($argument, $defaultType); - } - - if (is_array($argument)) { - $value = current($argument); - - if ($value instanceof ExpressionInterface || $value instanceof SqlInterface) { - return $this->buildNormalizedArgument($value, self::TYPE_VALUE); - } - - $key = key($argument); - - if (is_integer($key) && ! in_array($value, $this->allowedTypes)) { - return $this->buildNormalizedArgument($value, $defaultType); - } - - return $this->buildNormalizedArgument($key, $value); - } - - throw new Exception\InvalidArgumentException(sprintf( - '$argument should be %s or %s or %s or %s or %s, "%s" given', - 'null', - 'scalar', - 'array', - 'Zend\Db\Sql\ExpressionInterface', - 'Zend\Db\Sql\SqlInterface', - is_object($argument) ? get_class($argument) : gettype($argument) - )); - } - - /** - * @param mixed $argument - * @param string $argumentType - * - * @return array - * - * @throws Exception\InvalidArgumentException - */ - private function buildNormalizedArgument($argument, $argumentType) - { - if (! in_array($argumentType, $this->allowedTypes)) { - throw new Exception\InvalidArgumentException(sprintf( - 'Argument type should be in array(%s)', - implode(',', $this->allowedTypes) - )); - } - - return [ - $argument, - $argumentType, - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/AbstractPreparableSql.php b/bundled-libs/zendframework/zend-db/src/Sql/AbstractPreparableSql.php deleted file mode 100644 index 6d95f90d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/AbstractPreparableSql.php +++ /dev/null @@ -1,39 +0,0 @@ -getParameterContainer(); - - if (! $parameterContainer instanceof ParameterContainer) { - $parameterContainer = new ParameterContainer(); - - $statementContainer->setParameterContainer($parameterContainer); - } - - $statementContainer->setSql( - $this->buildSqlString($adapter->getPlatform(), $adapter->getDriver(), $parameterContainer) - ); - - return $statementContainer; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/AbstractSql.php b/bundled-libs/zendframework/zend-db/src/Sql/AbstractSql.php deleted file mode 100644 index f8935ca4..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/AbstractSql.php +++ /dev/null @@ -1,479 +0,0 @@ - '', 'subselectCount' => 0]; - - /** - * @var array - */ - protected $instanceParameterIndex = []; - - /** - * {@inheritDoc} - */ - public function getSqlString(PlatformInterface $adapterPlatform = null) - { - $adapterPlatform = ($adapterPlatform) ?: new DefaultAdapterPlatform; - return $this->buildSqlString($adapterPlatform); - } - - /** - * @param PlatformInterface $platform - * @param null|DriverInterface $driver - * @param null|ParameterContainer $parameterContainer - * @return string - */ - protected function buildSqlString( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - $this->localizeVariables(); - - $sqls = []; - $parameters = []; - - foreach ($this->specifications as $name => $specification) { - $parameters[$name] = $this->{'process' . $name}( - $platform, - $driver, - $parameterContainer, - $sqls, - $parameters - ); - - if ($specification && is_array($parameters[$name])) { - $sqls[$name] = $this->createSqlFromSpecificationAndParameters($specification, $parameters[$name]); - - continue; - } - - if (is_string($parameters[$name])) { - $sqls[$name] = $parameters[$name]; - } - } - - return rtrim(implode(' ', $sqls), "\n ,"); - } - - /** - * Render table with alias in from/join parts - * - * @todo move TableIdentifier concatenation here - * @param string $table - * @param string $alias - * @return string - */ - protected function renderTable($table, $alias = null) - { - return $table . ($alias ? ' AS ' . $alias : ''); - } - - /** - * @staticvar int $runtimeExpressionPrefix - * @param ExpressionInterface $expression - * @param PlatformInterface $platform - * @param null|DriverInterface $driver - * @param null|ParameterContainer $parameterContainer - * @param null|string $namedParameterPrefix - * @return string - * @throws Exception\RuntimeException - */ - protected function processExpression( - ExpressionInterface $expression, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null, - $namedParameterPrefix = null - ) { - $namedParameterPrefix = ! $namedParameterPrefix - ? $namedParameterPrefix - : $this->processInfo['paramPrefix'] . $namedParameterPrefix; - // static counter for the number of times this method was invoked across the PHP runtime - static $runtimeExpressionPrefix = 0; - - if ($parameterContainer && ((! is_string($namedParameterPrefix) || $namedParameterPrefix == ''))) { - $namedParameterPrefix = sprintf('expr%04dParam', ++$runtimeExpressionPrefix); - } else { - $namedParameterPrefix = preg_replace('/\s/', '__', $namedParameterPrefix); - } - - $sql = ''; - - // initialize variables - $parts = $expression->getExpressionData(); - - if (! isset($this->instanceParameterIndex[$namedParameterPrefix])) { - $this->instanceParameterIndex[$namedParameterPrefix] = 1; - } - - $expressionParamIndex = &$this->instanceParameterIndex[$namedParameterPrefix]; - - foreach ($parts as $part) { - // #7407: use $expression->getExpression() to get the unescaped - // version of the expression - if (is_string($part) && $expression instanceof Expression) { - $sql .= $expression->getExpression(); - continue; - } - - // If it is a string, simply tack it onto the return sql - // "specification" string - if (is_string($part)) { - $sql .= $part; - continue; - } - - if (! is_array($part)) { - throw new Exception\RuntimeException( - 'Elements returned from getExpressionData() array must be a string or array.' - ); - } - - // Process values and types (the middle and last position of the - // expression data) - $values = $part[1]; - $types = isset($part[2]) ? $part[2] : []; - foreach ($values as $vIndex => $value) { - if (! isset($types[$vIndex])) { - continue; - } - $type = $types[$vIndex]; - if ($value instanceof Select) { - // process sub-select - $values[$vIndex] = '(' - . $this->processSubSelect($value, $platform, $driver, $parameterContainer) - . ')'; - } elseif ($value instanceof ExpressionInterface) { - // recursive call to satisfy nested expressions - $values[$vIndex] = $this->processExpression( - $value, - $platform, - $driver, - $parameterContainer, - $namedParameterPrefix . $vIndex . 'subpart' - ); - } elseif ($type == ExpressionInterface::TYPE_IDENTIFIER) { - $values[$vIndex] = $platform->quoteIdentifierInFragment($value); - } elseif ($type == ExpressionInterface::TYPE_VALUE) { - // if prepareType is set, it means that this particular value must be - // passed back to the statement in a way it can be used as a placeholder value - if ($parameterContainer) { - $name = $namedParameterPrefix . $expressionParamIndex++; - $parameterContainer->offsetSet($name, $value); - $values[$vIndex] = $driver->formatParameterName($name); - continue; - } - - // if not a preparable statement, simply quote the value and move on - $values[$vIndex] = $platform->quoteValue($value); - } elseif ($type == ExpressionInterface::TYPE_LITERAL) { - $values[$vIndex] = $value; - } - } - - // After looping the values, interpolate them into the sql string - // (they might be placeholder names, or values) - $sql .= vsprintf($part[0], $values); - } - - return $sql; - } - - /** - * @param string|array $specifications - * @param array $parameters - * - * @return string - * - * @throws Exception\RuntimeException - */ - protected function createSqlFromSpecificationAndParameters($specifications, $parameters) - { - if (is_string($specifications)) { - return vsprintf($specifications, $parameters); - } - - $parametersCount = count($parameters); - - foreach ($specifications as $specificationString => $paramSpecs) { - if ($parametersCount == count($paramSpecs)) { - break; - } - - unset($specificationString, $paramSpecs); - } - - if (! isset($specificationString)) { - throw new Exception\RuntimeException( - 'A number of parameters was found that is not supported by this specification' - ); - } - - $topParameters = []; - foreach ($parameters as $position => $paramsForPosition) { - if (isset($paramSpecs[$position]['combinedby'])) { - $multiParamValues = []; - foreach ($paramsForPosition as $multiParamsForPosition) { - if (is_array($multiParamsForPosition)) { - $ppCount = count($multiParamsForPosition); - } else { - $ppCount = 1; - } - - if (! isset($paramSpecs[$position][$ppCount])) { - throw new Exception\RuntimeException(sprintf( - 'A number of parameters (%d) was found that is not supported by this specification', - $ppCount - )); - } - $multiParamValues[] = vsprintf($paramSpecs[$position][$ppCount], $multiParamsForPosition); - } - $topParameters[] = implode($paramSpecs[$position]['combinedby'], $multiParamValues); - } elseif ($paramSpecs[$position] !== null) { - $ppCount = count($paramsForPosition); - if (! isset($paramSpecs[$position][$ppCount])) { - throw new Exception\RuntimeException(sprintf( - 'A number of parameters (%d) was found that is not supported by this specification', - $ppCount - )); - } - $topParameters[] = vsprintf($paramSpecs[$position][$ppCount], $paramsForPosition); - } else { - $topParameters[] = $paramsForPosition; - } - } - return vsprintf($specificationString, $topParameters); - } - - /** - * @param Select $subselect - * @param PlatformInterface $platform - * @param null|DriverInterface $driver - * @param null|ParameterContainer $parameterContainer - * @return string - */ - protected function processSubSelect( - Select $subselect, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this instanceof PlatformDecoratorInterface) { - $decorator = clone $this; - $decorator->setSubject($subselect); - } else { - $decorator = $subselect; - } - - if ($parameterContainer) { - // Track subselect prefix and count for parameters - $processInfoContext = ($decorator instanceof PlatformDecoratorInterface) ? $subselect : $decorator; - $this->processInfo['subselectCount']++; - $processInfoContext->processInfo['subselectCount'] = $this->processInfo['subselectCount']; - $processInfoContext->processInfo['paramPrefix'] = 'subselect' - . $processInfoContext->processInfo['subselectCount']; - - $sql = $decorator->buildSqlString($platform, $driver, $parameterContainer); - - // copy count - $this->processInfo['subselectCount'] = $decorator->processInfo['subselectCount']; - return $sql; - } - - return $decorator->buildSqlString($platform, $driver, $parameterContainer); - } - - /** - * @param Join[] $joins - * @param PlatformInterface $platform - * @param null|DriverInterface $driver - * @param null|ParameterContainer $parameterContainer - * @return null|string[] Null if no joins present, array of JOIN statements - * otherwise - * @throws Exception\InvalidArgumentException for invalid JOIN table names. - */ - protected function processJoin( - Join $joins, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if (! $joins->count()) { - return; - } - - // process joins - $joinSpecArgArray = []; - foreach ($joins->getJoins() as $j => $join) { - $joinName = null; - $joinAs = null; - - // table name - if (is_array($join['name'])) { - $joinName = current($join['name']); - $joinAs = $platform->quoteIdentifier(key($join['name'])); - } else { - $joinName = $join['name']; - } - - if ($joinName instanceof Expression) { - $joinName = $joinName->getExpression(); - } elseif ($joinName instanceof TableIdentifier) { - $joinName = $joinName->getTableAndSchema(); - $joinName = ($joinName[1] - ? $platform->quoteIdentifier($joinName[1]) . $platform->getIdentifierSeparator() - : '') . $platform->quoteIdentifier($joinName[0]); - } elseif ($joinName instanceof Select) { - $joinName = '(' . $this->processSubSelect($joinName, $platform, $driver, $parameterContainer) . ')'; - } elseif (is_string($joinName) || (is_object($joinName) && is_callable([$joinName, '__toString']))) { - $joinName = $platform->quoteIdentifier($joinName); - } else { - throw new Exception\InvalidArgumentException(sprintf( - 'Join name expected to be Expression|TableIdentifier|Select|string, "%s" given', - gettype($joinName) - )); - } - - $joinSpecArgArray[$j] = [ - strtoupper($join['type']), - $this->renderTable($joinName, $joinAs), - ]; - - // on expression - // note: for Expression objects, pass them to processExpression with a prefix specific to each join - // (used for named parameters) - if (($join['on'] instanceof ExpressionInterface)) { - $joinSpecArgArray[$j][] = $this->processExpression( - $join['on'], - $platform, - $driver, - $parameterContainer, - 'join' . ($j + 1) . 'part' - ); - } else { - // on - $joinSpecArgArray[$j][] = $platform->quoteIdentifierInFragment( - $join['on'], - ['=', 'AND', 'OR', '(', ')', 'BETWEEN', '<', '>'] - ); - } - } - - return [$joinSpecArgArray]; - } - - /** - * @param null|array|ExpressionInterface|Select $column - * @param PlatformInterface $platform - * @param null|DriverInterface $driver - * @param null|string $namedParameterPrefix - * @param null|ParameterContainer $parameterContainer - * @return string - */ - protected function resolveColumnValue( - $column, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null, - $namedParameterPrefix = null - ) { - $namedParameterPrefix = ! $namedParameterPrefix - ? $namedParameterPrefix - : $this->processInfo['paramPrefix'] . $namedParameterPrefix; - $isIdentifier = false; - $fromTable = ''; - if (is_array($column)) { - if (isset($column['isIdentifier'])) { - $isIdentifier = (bool) $column['isIdentifier']; - } - if (isset($column['fromTable']) && $column['fromTable'] !== null) { - $fromTable = $column['fromTable']; - } - $column = $column['column']; - } - - if ($column instanceof ExpressionInterface) { - return $this->processExpression($column, $platform, $driver, $parameterContainer, $namedParameterPrefix); - } - if ($column instanceof Select) { - return '(' . $this->processSubSelect($column, $platform, $driver, $parameterContainer) . ')'; - } - if ($column === null) { - return 'NULL'; - } - return $isIdentifier - ? $fromTable . $platform->quoteIdentifierInFragment($column) - : $platform->quoteValue($column); - } - - /** - * @param string|TableIdentifier|Select $table - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @return string - */ - protected function resolveTable( - $table, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - $schema = null; - if ($table instanceof TableIdentifier) { - list($table, $schema) = $table->getTableAndSchema(); - } - - if ($table instanceof Select) { - $table = '(' . $this->processSubselect($table, $platform, $driver, $parameterContainer) . ')'; - } elseif ($table) { - $table = $platform->quoteIdentifier($table); - } - - if ($schema && $table) { - $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table; - } - return $table; - } - - /** - * Copy variables from the subject into the local properties - */ - protected function localizeVariables() - { - if (! $this instanceof PlatformDecoratorInterface) { - return; - } - - foreach (get_object_vars($this->subject) as $name => $value) { - $this->{$name} = $value; - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Combine.php b/bundled-libs/zendframework/zend-db/src/Sql/Combine.php deleted file mode 100644 index bedb170f..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Combine.php +++ /dev/null @@ -1,212 +0,0 @@ - '%1$s (%2$s) ', - ]; - - /** - * @var Select[][] - */ - private $combine = []; - - /** - * @param Select|array|null $select - * @param string $type - * @param string $modifier - */ - public function __construct($select = null, $type = self::COMBINE_UNION, $modifier = '') - { - if ($select) { - $this->combine($select, $type, $modifier); - } - } - - /** - * Create combine clause - * - * @param Select|array $select - * @param string $type - * @param string $modifier - * - * @return self Provides a fluent interface - * - * @throws Exception\InvalidArgumentException - */ - public function combine($select, $type = self::COMBINE_UNION, $modifier = '') - { - if (is_array($select)) { - foreach ($select as $combine) { - if ($combine instanceof Select) { - $combine = [$combine]; - } - - $this->combine( - $combine[0], - isset($combine[1]) ? $combine[1] : $type, - isset($combine[2]) ? $combine[2] : $modifier - ); - } - return $this; - } - - if (! $select instanceof Select) { - throw new Exception\InvalidArgumentException(sprintf( - '$select must be a array or instance of Select, "%s" given', - is_object($select) ? get_class($select) : gettype($select) - )); - } - - $this->combine[] = [ - 'select' => $select, - 'type' => $type, - 'modifier' => $modifier - ]; - return $this; - } - - /** - * Create union clause - * - * @param Select|array $select - * @param string $modifier - * - * @return self - */ - public function union($select, $modifier = '') - { - return $this->combine($select, self::COMBINE_UNION, $modifier); - } - - /** - * Create except clause - * - * @param Select|array $select - * @param string $modifier - * - * @return self - */ - public function except($select, $modifier = '') - { - return $this->combine($select, self::COMBINE_EXCEPT, $modifier); - } - - /** - * Create intersect clause - * - * @param Select|array $select - * @param string $modifier - * @return self - */ - public function intersect($select, $modifier = '') - { - return $this->combine($select, self::COMBINE_INTERSECT, $modifier); - } - - /** - * Build sql string - * - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * - * @return string - */ - protected function buildSqlString( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if (! $this->combine) { - return; - } - - $sql = ''; - foreach ($this->combine as $i => $combine) { - $type = $i == 0 - ? '' - : strtoupper($combine['type'] . ($combine['modifier'] ? ' ' . $combine['modifier'] : '')); - $select = $this->processSubSelect($combine['select'], $platform, $driver, $parameterContainer); - $sql .= sprintf( - $this->specifications[self::COMBINE], - $type, - $select - ); - } - return trim($sql, ' '); - } - - /** - * @return self Provides a fluent interface - */ - public function alignColumns() - { - if (! $this->combine) { - return $this; - } - - $allColumns = []; - foreach ($this->combine as $combine) { - $allColumns = array_merge( - $allColumns, - $combine['select']->getRawState(self::COLUMNS) - ); - } - - foreach ($this->combine as $combine) { - $combineColumns = $combine['select']->getRawState(self::COLUMNS); - $aligned = []; - foreach ($allColumns as $alias => $column) { - $aligned[$alias] = isset($combineColumns[$alias]) - ? $combineColumns[$alias] - : new Predicate\Expression('NULL'); - } - $combine['select']->columns($aligned, false); - } - return $this; - } - - /** - * Get raw state - * - * @param string $key - * - * @return array - */ - public function getRawState($key = null) - { - $rawState = [ - self::COMBINE => $this->combine, - self::COLUMNS => $this->combine - ? $this->combine[0]['select']->getRawState(self::COLUMNS) - : [], - ]; - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/AlterTable.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/AlterTable.php deleted file mode 100644 index bee08f99..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/AlterTable.php +++ /dev/null @@ -1,238 +0,0 @@ - "ALTER TABLE %1\$s\n", - self::ADD_COLUMNS => [ - "%1\$s" => [ - [1 => "ADD COLUMN %1\$s,\n", 'combinedby' => ""] - ] - ], - self::CHANGE_COLUMNS => [ - "%1\$s" => [ - [2 => "CHANGE COLUMN %1\$s %2\$s,\n", 'combinedby' => ""], - ] - ], - self::DROP_COLUMNS => [ - "%1\$s" => [ - [1 => "DROP COLUMN %1\$s,\n", 'combinedby' => ""], - ] - ], - self::ADD_CONSTRAINTS => [ - "%1\$s" => [ - [1 => "ADD %1\$s,\n", 'combinedby' => ""], - ] - ], - self::DROP_CONSTRAINTS => [ - "%1\$s" => [ - [1 => "DROP CONSTRAINT %1\$s,\n", 'combinedby' => ""], - ] - ] - ]; - - /** - * @var string - */ - protected $table = ''; - - /** - * @param string|TableIdentifier $table - */ - public function __construct($table = '') - { - ($table) ? $this->setTable($table) : null; - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function setTable($name) - { - $this->table = $name; - - return $this; - } - - /** - * @param Column\ColumnInterface $column - * @return self Provides a fluent interface - */ - public function addColumn(Column\ColumnInterface $column) - { - $this->addColumns[] = $column; - - return $this; - } - - /** - * @param string $name - * @param Column\ColumnInterface $column - * @return self Provides a fluent interface - */ - public function changeColumn($name, Column\ColumnInterface $column) - { - $this->changeColumns[$name] = $column; - - return $this; - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function dropColumn($name) - { - $this->dropColumns[] = $name; - - return $this; - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function dropConstraint($name) - { - $this->dropConstraints[] = $name; - - return $this; - } - - /** - * @param Constraint\ConstraintInterface $constraint - * @return self Provides a fluent interface - */ - public function addConstraint(Constraint\ConstraintInterface $constraint) - { - $this->addConstraints[] = $constraint; - - return $this; - } - - /** - * @param string|null $key - * @return array - */ - public function getRawState($key = null) - { - $rawState = [ - self::TABLE => $this->table, - self::ADD_COLUMNS => $this->addColumns, - self::DROP_COLUMNS => $this->dropColumns, - self::CHANGE_COLUMNS => $this->changeColumns, - self::ADD_CONSTRAINTS => $this->addConstraints, - self::DROP_CONSTRAINTS => $this->dropConstraints, - ]; - - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - protected function processTable(PlatformInterface $adapterPlatform = null) - { - return [$this->resolveTable($this->table, $adapterPlatform)]; - } - - protected function processAddColumns(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->addColumns as $column) { - $sqls[] = $this->processExpression($column, $adapterPlatform); - } - - return [$sqls]; - } - - protected function processChangeColumns(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->changeColumns as $name => $column) { - $sqls[] = [ - $adapterPlatform->quoteIdentifier($name), - $this->processExpression($column, $adapterPlatform) - ]; - } - - return [$sqls]; - } - - protected function processDropColumns(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->dropColumns as $column) { - $sqls[] = $adapterPlatform->quoteIdentifier($column); - } - - return [$sqls]; - } - - protected function processAddConstraints(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->addConstraints as $constraint) { - $sqls[] = $this->processExpression($constraint, $adapterPlatform); - } - - return [$sqls]; - } - - protected function processDropConstraints(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->dropConstraints as $constraint) { - $sqls[] = $adapterPlatform->quoteIdentifier($constraint); - } - - return [$sqls]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php deleted file mode 100644 index 59e499d1..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php +++ /dev/null @@ -1,71 +0,0 @@ -setLength($length); - - parent::__construct($name, $nullable, $default, $options); - } - - /** - * @param int $length - * @return self Provides a fluent interface - */ - public function setLength($length) - { - $this->length = (int) $length; - - return $this; - } - - /** - * @return int - */ - public function getLength() - { - return $this->length; - } - - /** - * @return string - */ - protected function getLengthExpression() - { - return (string) $this->length; - } - - /** - * @return array - */ - public function getExpressionData() - { - $data = parent::getExpressionData(); - - if ($this->getLengthExpression()) { - $data[0][1][1] .= '(' . $this->getLengthExpression() . ')'; - } - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php deleted file mode 100644 index 3edba684..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php +++ /dev/null @@ -1,86 +0,0 @@ -setDecimal($decimal); - - parent::__construct($name, $digits, $nullable, $default, $options); - } - - /** - * @param int $digits - * - * @return self - */ - public function setDigits($digits) - { - return $this->setLength($digits); - } - - /** - * @return int - */ - public function getDigits() - { - return $this->getLength(); - } - - /** - * @param int|null $decimal - * @return self Provides a fluent interface - */ - public function setDecimal($decimal) - { - $this->decimal = null === $decimal ? null : (int) $decimal; - - return $this; - } - - /** - * @return int|null - */ - public function getDecimal() - { - return $this->decimal; - } - - /** - * {@inheritDoc} - */ - protected function getLengthExpression() - { - if ($this->decimal !== null) { - return $this->length . ',' . $this->decimal; - } - - return $this->length; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php deleted file mode 100644 index e71d3791..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php +++ /dev/null @@ -1,63 +0,0 @@ -specification; - - $params = []; - $params[] = $this->name; - $params[] = $this->type; - - $types = [self::TYPE_IDENTIFIER, self::TYPE_LITERAL]; - - if (! $this->isNullable) { - $spec .= ' NOT NULL'; - } - - if ($this->default !== null) { - $spec .= ' DEFAULT %s'; - $params[] = $this->default; - $types[] = self::TYPE_VALUE; - } - - $options = $this->getOptions(); - - if (isset($options['on_update'])) { - $spec .= ' %s'; - $params[] = 'ON UPDATE CURRENT_TIMESTAMP'; - $types[] = self::TYPE_LITERAL; - } - - $data = [[ - $spec, - $params, - $types, - ]]; - - foreach ($this->constraints as $constraint) { - $data[] = ' '; - $data = array_merge($data, $constraint->getExpressionData()); - } - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php deleted file mode 100644 index 83463381..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php +++ /dev/null @@ -1,18 +0,0 @@ -setName($name); - $this->setNullable($nullable); - $this->setDefault($default); - $this->setOptions($options); - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function setName($name) - { - $this->name = (string) $name; - return $this; - } - - /** - * @return null|string - */ - public function getName() - { - return $this->name; - } - - /** - * @param bool $nullable - * @return self Provides a fluent interface - */ - public function setNullable($nullable) - { - $this->isNullable = (bool) $nullable; - return $this; - } - - /** - * @return bool - */ - public function isNullable() - { - return $this->isNullable; - } - - /** - * @param null|string|int $default - * @return self Provides a fluent interface - */ - public function setDefault($default) - { - $this->default = $default; - return $this; - } - - /** - * @return null|string|int - */ - public function getDefault() - { - return $this->default; - } - - /** - * @param array $options - * @return self Provides a fluent interface - */ - public function setOptions(array $options) - { - $this->options = $options; - return $this; - } - - /** - * @param string $name - * @param string $value - * @return self Provides a fluent interface - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - return $this; - } - - /** - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * @param ConstraintInterface $constraint - * - * @return self Provides a fluent interface - */ - public function addConstraint(ConstraintInterface $constraint) - { - $this->constraints[] = $constraint; - - return $this; - } - - /** - * @return array - */ - public function getExpressionData() - { - $spec = $this->specification; - - $params = []; - $params[] = $this->name; - $params[] = $this->type; - - $types = [self::TYPE_IDENTIFIER, self::TYPE_LITERAL]; - - if (! $this->isNullable) { - $spec .= ' NOT NULL'; - } - - if ($this->default !== null) { - $spec .= ' DEFAULT %s'; - $params[] = $this->default; - $types[] = self::TYPE_VALUE; - } - - $data = [[ - $spec, - $params, - $types, - ]]; - - foreach ($this->constraints as $constraint) { - $data[] = ' '; - $data = array_merge($data, $constraint->getExpressionData()); - } - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php deleted file mode 100644 index ff38b5a0..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -getOptions(); - - if (isset($options['length'])) { - $data[0][1][1] .= '(' . $options['length'] . ')'; - } - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Text.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Text.php deleted file mode 100644 index 53ceafaa..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Column/Text.php +++ /dev/null @@ -1,18 +0,0 @@ -setColumns($columns); - } - - $this->setName($name); - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function setName($name) - { - $this->name = (string) $name; - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param null|string|array $columns - * @return self Provides a fluent interface - */ - public function setColumns($columns) - { - $this->columns = (array) $columns; - - return $this; - } - - /** - * @param string $column - * @return self Provides a fluent interface - */ - public function addColumn($column) - { - $this->columns[] = $column; - return $this; - } - - /** - * {@inheritDoc} - */ - public function getColumns() - { - return $this->columns; - } - - /** - * {@inheritDoc} - */ - public function getExpressionData() - { - $colCount = count($this->columns); - $newSpecTypes = []; - $values = []; - $newSpec = ''; - - if ($this->name) { - $newSpec .= $this->namedSpecification; - $values[] = $this->name; - $newSpecTypes[] = self::TYPE_IDENTIFIER; - } - - $newSpec .= $this->specification; - - if ($colCount) { - $values = array_merge($values, $this->columns); - $newSpecParts = array_fill(0, $colCount, '%s'); - $newSpecTypes = array_merge($newSpecTypes, array_fill(0, $colCount, self::TYPE_IDENTIFIER)); - $newSpec .= sprintf($this->columnSpecification, implode(', ', $newSpecParts)); - } - - return [[ - $newSpec, - $values, - $newSpecTypes, - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php deleted file mode 100644 index df3917b0..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php +++ /dev/null @@ -1,56 +0,0 @@ -expression = $expression; - $this->name = $name; - } - - /** - * {@inheritDoc} - */ - public function getExpressionData() - { - $newSpecTypes = [self::TYPE_LITERAL]; - $values = [$this->expression]; - $newSpec = ''; - - if ($this->name) { - $newSpec .= $this->namedSpecification; - - array_unshift($values, $this->name); - array_unshift($newSpecTypes, self::TYPE_IDENTIFIER); - } - - return [[ - $newSpec . $this->specification, - $values, - $newSpecTypes, - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php deleted file mode 100644 index aaa09202..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php +++ /dev/null @@ -1,17 +0,0 @@ -setName($name); - $this->setColumns($columns); - $this->setReferenceTable($referenceTable); - $this->setReferenceColumn($referenceColumn); - - if ($onDeleteRule) { - $this->setOnDeleteRule($onDeleteRule); - } - - if ($onUpdateRule) { - $this->setOnUpdateRule($onUpdateRule); - } - } - - /** - * @param string $referenceTable - * @return self Provides a fluent interface - */ - public function setReferenceTable($referenceTable) - { - $this->referenceTable = (string) $referenceTable; - return $this; - } - - /** - * @return string - */ - public function getReferenceTable() - { - return $this->referenceTable; - } - - /** - * @param null|string|array $referenceColumn - * @return self Provides a fluent interface - */ - public function setReferenceColumn($referenceColumn) - { - $this->referenceColumn = (array) $referenceColumn; - - return $this; - } - - /** - * @return array - */ - public function getReferenceColumn() - { - return $this->referenceColumn; - } - - /** - * @param string $onDeleteRule - * @return self Provides a fluent interface - */ - public function setOnDeleteRule($onDeleteRule) - { - $this->onDeleteRule = (string) $onDeleteRule; - - return $this; - } - - /** - * @return string - */ - public function getOnDeleteRule() - { - return $this->onDeleteRule; - } - - /** - * @param string $onUpdateRule - * @return self Provides a fluent interface - */ - public function setOnUpdateRule($onUpdateRule) - { - $this->onUpdateRule = (string) $onUpdateRule; - - return $this; - } - - /** - * @return string - */ - public function getOnUpdateRule() - { - return $this->onUpdateRule; - } - - /** - * @return array - */ - public function getExpressionData() - { - $data = parent::getExpressionData(); - $colCount = count($this->referenceColumn); - $newSpecTypes = [self::TYPE_IDENTIFIER]; - $values = [$this->referenceTable]; - - $data[0][0] .= $this->referenceSpecification[0]; - - if ($colCount) { - $values = array_merge($values, $this->referenceColumn); - $newSpecParts = array_fill(0, $colCount, '%s'); - $newSpecTypes = array_merge($newSpecTypes, array_fill(0, $colCount, self::TYPE_IDENTIFIER)); - - $data[0][0] .= sprintf('(%s) ', implode(', ', $newSpecParts)); - } - - $data[0][0] .= $this->referenceSpecification[1]; - - $values[] = $this->onDeleteRule; - $values[] = $this->onUpdateRule; - $newSpecTypes[] = self::TYPE_LITERAL; - $newSpecTypes[] = self::TYPE_LITERAL; - - $data[0][1] = array_merge($data[0][1], $values); - $data[0][2] = array_merge($data[0][2], $newSpecTypes); - - return $data; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php deleted file mode 100644 index 9775bb01..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php +++ /dev/null @@ -1,18 +0,0 @@ - 'CREATE %1$sTABLE %2$s (', - self::COLUMNS => [ - "\n %1\$s" => [ - [1 => '%1$s', 'combinedby' => ",\n "] - ] - ], - 'combinedBy' => ",", - self::CONSTRAINTS => [ - "\n %1\$s" => [ - [1 => '%1$s', 'combinedby' => ",\n "] - ] - ], - 'statementEnd' => '%1$s', - ]; - - /** - * @var string - */ - protected $table = ''; - - /** - * @param string|TableIdentifier $table - * @param bool $isTemporary - */ - public function __construct($table = '', $isTemporary = false) - { - $this->table = $table; - $this->setTemporary($isTemporary); - } - - /** - * @param bool $temporary - * @return self Provides a fluent interface - */ - public function setTemporary($temporary) - { - $this->isTemporary = (bool) $temporary; - return $this; - } - - /** - * @return bool - */ - public function isTemporary() - { - return $this->isTemporary; - } - - /** - * @param string $name - * @return self Provides a fluent interface - */ - public function setTable($name) - { - $this->table = $name; - return $this; - } - - /** - * @param Column\ColumnInterface $column - * @return self Provides a fluent interface - */ - public function addColumn(Column\ColumnInterface $column) - { - $this->columns[] = $column; - return $this; - } - - /** - * @param Constraint\ConstraintInterface $constraint - * @return self Provides a fluent interface - */ - public function addConstraint(Constraint\ConstraintInterface $constraint) - { - $this->constraints[] = $constraint; - return $this; - } - - /** - * @param string|null $key - * @return array - */ - public function getRawState($key = null) - { - $rawState = [ - self::COLUMNS => $this->columns, - self::CONSTRAINTS => $this->constraints, - self::TABLE => $this->table, - ]; - - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - /** - * @param PlatformInterface $adapterPlatform - * - * @return string[] - */ - protected function processTable(PlatformInterface $adapterPlatform = null) - { - return [ - $this->isTemporary ? 'TEMPORARY ' : '', - $this->resolveTable($this->table, $adapterPlatform), - ]; - } - - /** - * @param PlatformInterface $adapterPlatform - * - * @return string[][]|null - */ - protected function processColumns(PlatformInterface $adapterPlatform = null) - { - if (! $this->columns) { - return; - } - - $sqls = []; - - foreach ($this->columns as $column) { - $sqls[] = $this->processExpression($column, $adapterPlatform); - } - - return [$sqls]; - } - - /** - * @param PlatformInterface $adapterPlatform - * - * @return array|string - */ - protected function processCombinedby(PlatformInterface $adapterPlatform = null) - { - if ($this->constraints && $this->columns) { - return $this->specifications['combinedBy']; - } - } - - /** - * @param PlatformInterface $adapterPlatform - * - * @return string[][]|null - */ - protected function processConstraints(PlatformInterface $adapterPlatform = null) - { - if (! $this->constraints) { - return; - } - - $sqls = []; - - foreach ($this->constraints as $constraint) { - $sqls[] = $this->processExpression($constraint, $adapterPlatform); - } - - return [$sqls]; - } - - /** - * @param PlatformInterface $adapterPlatform - * - * @return string[] - */ - protected function processStatementEnd(PlatformInterface $adapterPlatform = null) - { - return ["\n)"]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/DropTable.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/DropTable.php deleted file mode 100644 index c42f8399..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/DropTable.php +++ /dev/null @@ -1,44 +0,0 @@ - 'DROP TABLE %1$s' - ]; - - /** - * @var string - */ - protected $table = ''; - - /** - * @param string|TableIdentifier $table - */ - public function __construct($table = '') - { - $this->table = $table; - } - - protected function processTable(PlatformInterface $adapterPlatform = null) - { - return [$this->resolveTable($this->table, $adapterPlatform)]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php deleted file mode 100644 index c11efb5d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php +++ /dev/null @@ -1,16 +0,0 @@ -setColumns($columns); - - $this->name = null === $name ? null : (string) $name; - $this->lengths = $lengths; - } - - /** - * - * @return array of array|string should return an array in the format: - * - * array ( - * // a sprintf formatted string - * string $specification, - * - * // the values for the above sprintf formatted string - * array $values, - * - * // an array of equal length of the $values array, with either TYPE_IDENTIFIER or TYPE_VALUE for each value - * array $types, - * ) - * - */ - public function getExpressionData() - { - $colCount = count($this->columns); - $values = []; - $values[] = $this->name ?: ''; - $newSpecTypes = [self::TYPE_IDENTIFIER]; - $newSpecParts = []; - - for ($i = 0; $i < $colCount; $i++) { - $specPart = '%s'; - - if (isset($this->lengths[$i])) { - $specPart .= "({$this->lengths[$i]})"; - } - - $newSpecParts[] = $specPart; - $newSpecTypes[] = self::TYPE_IDENTIFIER; - } - - $newSpec = str_replace('...', implode(', ', $newSpecParts), $this->specification); - - return [[ - $newSpec, - array_merge($values, $this->columns), - $newSpecTypes, - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php deleted file mode 100644 index 0f8660f4..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php +++ /dev/null @@ -1,16 +0,0 @@ - 'DELETE FROM %1$s', - self::SPECIFICATION_WHERE => 'WHERE %1$s' - ]; - - /** - * @var string|TableIdentifier - */ - protected $table = ''; - - /** - * @var bool - */ - protected $emptyWhereProtection = true; - - /** - * @var array - */ - protected $set = []; - - /** - * @var null|string|Where - */ - protected $where = null; - - /** - * Constructor - * - * @param null|string|TableIdentifier $table - */ - public function __construct($table = null) - { - if ($table) { - $this->from($table); - } - $this->where = new Where(); - } - - /** - * Create from statement - * - * @param string|TableIdentifier $table - * @return self Provides a fluent interface - */ - public function from($table) - { - $this->table = $table; - return $this; - } - - /** - * @param null $key - * - * @return mixed - */ - public function getRawState($key = null) - { - $rawState = [ - 'emptyWhereProtection' => $this->emptyWhereProtection, - 'table' => $this->table, - 'set' => $this->set, - 'where' => $this->where - ]; - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - /** - * Create where clause - * - * @param Where|\Closure|string|array $predicate - * @param string $combination One of the OP_* constants from Predicate\PredicateSet - * - * @return self Provides a fluent interface - */ - public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) - { - if ($predicate instanceof Where) { - $this->where = $predicate; - } else { - $this->where->addPredicates($predicate, $combination); - } - return $this; - } - - /** - * @param PlatformInterface $platform - * @param DriverInterface|null $driver - * @param ParameterContainer|null $parameterContainer - * - * @return string - */ - protected function processDelete( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return sprintf( - $this->specifications[static::SPECIFICATION_DELETE], - $this->resolveTable($this->table, $platform, $driver, $parameterContainer) - ); - } - - /** - * @param PlatformInterface $platform - * @param DriverInterface|null $driver - * @param ParameterContainer|null $parameterContainer - * - * @return null|string - */ - protected function processWhere( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->where->count() == 0) { - return; - } - - return sprintf( - $this->specifications[static::SPECIFICATION_WHERE], - $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') - ); - } - - /** - * Property overloading - * - * Overloads "where" only. - * - * @param string $name - * - * @return Where|null - */ - public function __get($name) - { - switch (strtolower($name)) { - case 'where': - return $this->where; - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php deleted file mode 100644 index 138f7e4d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -setExpression($expression); - } - - if ($types) { // should be deprecated and removed version 3.0.0 - if (is_array($parameters)) { - foreach ($parameters as $i => $parameter) { - $parameters[$i] = [ - $parameter => isset($types[$i]) ? $types[$i] : self::TYPE_VALUE, - ]; - } - } elseif (is_scalar($parameters)) { - $parameters = [ - $parameters => $types[0], - ]; - } - } - - if ($parameters) { - $this->setParameters($parameters); - } - } - - /** - * @param $expression - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setExpression($expression) - { - if (! is_string($expression) || $expression == '') { - throw new Exception\InvalidArgumentException('Supplied expression must be a string.'); - } - $this->expression = $expression; - return $this; - } - - /** - * @return string - */ - public function getExpression() - { - return $this->expression; - } - - /** - * @param $parameters - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setParameters($parameters) - { - if (! is_scalar($parameters) && ! is_array($parameters)) { - throw new Exception\InvalidArgumentException('Expression parameters must be a scalar or array.'); - } - $this->parameters = $parameters; - return $this; - } - - /** - * @return array - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * @deprecated - * @param array $types - * @return self Provides a fluent interface - */ - public function setTypes(array $types) - { - $this->types = $types; - return $this; - } - - /** - * @deprecated - * @return array - */ - public function getTypes() - { - return $this->types; - } - - /** - * @return array - * @throws Exception\RuntimeException - */ - public function getExpressionData() - { - $parameters = (is_scalar($this->parameters)) ? [$this->parameters] : $this->parameters; - $parametersCount = count($parameters); - $expression = str_replace('%', '%%', $this->expression); - - if ($parametersCount == 0) { - return [ - str_ireplace(self::PLACEHOLDER, '', $expression) - ]; - } - - // assign locally, escaping % signs - $expression = str_replace(self::PLACEHOLDER, '%s', $expression, $count); - - // test number of replacements without considering same variable begin used many times first, which is - // faster, if the test fails then resort to regex which are slow and used rarely - if ($count !== $parametersCount && $parametersCount === preg_match_all('/\:[a-zA-Z0-9_]*/', $expression)) { - throw new Exception\RuntimeException( - 'The number of replacements in the expression does not match the number of parameters' - ); - } - - foreach ($parameters as $parameter) { - list($values[], $types[]) = $this->normalizeArgument($parameter, self::TYPE_VALUE); - } - return [[ - $expression, - $values, - $types - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/ExpressionInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/ExpressionInterface.php deleted file mode 100644 index 282b4086..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/ExpressionInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - 'INSERT INTO %1$s (%2$s) VALUES (%3$s)', - self::SPECIFICATION_SELECT => 'INSERT INTO %1$s %2$s %3$s', - ]; - - /** - * @var string|TableIdentifier - */ - protected $table = null; - protected $columns = []; - - /** - * @var array|Select - */ - protected $select = null; - - /** - * Constructor - * - * @param null|string|TableIdentifier $table - */ - public function __construct($table = null) - { - if ($table) { - $this->into($table); - } - } - - /** - * Create INTO clause - * - * @param string|TableIdentifier $table - * @return self Provides a fluent interface - */ - public function into($table) - { - $this->table = $table; - return $this; - } - - /** - * Specify columns - * - * @param array $columns - * @return self Provides a fluent interface - */ - public function columns(array $columns) - { - $this->columns = array_flip($columns); - return $this; - } - - /** - * Specify values to insert - * - * @param array|Select $values - * @param string $flag one of VALUES_MERGE or VALUES_SET; defaults to VALUES_SET - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function values($values, $flag = self::VALUES_SET) - { - if ($values instanceof Select) { - if ($flag == self::VALUES_MERGE) { - throw new Exception\InvalidArgumentException( - 'A Zend\Db\Sql\Select instance cannot be provided with the merge flag' - ); - } - $this->select = $values; - return $this; - } - - if (! is_array($values)) { - throw new Exception\InvalidArgumentException( - 'values() expects an array of values or Zend\Db\Sql\Select instance' - ); - } - - if ($this->select && $flag == self::VALUES_MERGE) { - throw new Exception\InvalidArgumentException( - 'An array of values cannot be provided with the merge flag when a Zend\Db\Sql\Select instance already ' - . 'exists as the value source' - ); - } - - if ($flag == self::VALUES_SET) { - $this->columns = $this->isAssocativeArray($values) - ? $values - : array_combine(array_keys($this->columns), array_values($values)); - } else { - foreach ($values as $column => $value) { - $this->columns[$column] = $value; - } - } - return $this; - } - - - /** - * Simple test for an associative array - * - * @link http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential - * @param array $array - * @return bool - */ - private function isAssocativeArray(array $array) - { - return array_keys($array) !== range(0, count($array) - 1); - } - - /** - * Create INTO SELECT clause - * - * @param Select $select - * @return self - */ - public function select(Select $select) - { - return $this->values($select); - } - - /** - * Get raw state - * - * @param string $key - * @return mixed - */ - public function getRawState($key = null) - { - $rawState = [ - 'table' => $this->table, - 'columns' => array_keys($this->columns), - 'values' => array_values($this->columns) - ]; - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - protected function processInsert( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->select) { - return; - } - if (! $this->columns) { - throw new Exception\InvalidArgumentException('values or select should be present'); - } - - $columns = []; - $values = []; - $i = 0; - - foreach ($this->columns as $column => $value) { - $columns[] = $platform->quoteIdentifier($column); - if (is_scalar($value) && $parameterContainer) { - // use incremental value instead of column name for PDO - // @see https://github.com/zendframework/zend-db/issues/35 - if ($driver instanceof Pdo) { - $column = 'c_' . $i++; - } - $values[] = $driver->formatParameterName($column); - $parameterContainer->offsetSet($column, $value); - } else { - $values[] = $this->resolveColumnValue( - $value, - $platform, - $driver, - $parameterContainer - ); - } - } - return sprintf( - $this->specifications[static::SPECIFICATION_INSERT], - $this->resolveTable($this->table, $platform, $driver, $parameterContainer), - implode(', ', $columns), - implode(', ', $values) - ); - } - - protected function processSelect( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if (! $this->select) { - return; - } - $selectSql = $this->processSubSelect($this->select, $platform, $driver, $parameterContainer); - - $columns = array_map([$platform, 'quoteIdentifier'], array_keys($this->columns)); - $columns = implode(', ', $columns); - - return sprintf( - $this->specifications[static::SPECIFICATION_SELECT], - $this->resolveTable($this->table, $platform, $driver, $parameterContainer), - $columns ? "($columns)" : "", - $selectSql - ); - } - - /** - * Overloading: variable setting - * - * Proxies to values, using VALUES_MERGE strategy - * - * @param string $name - * @param mixed $value - * @return self Provides a fluent interface - */ - public function __set($name, $value) - { - $this->columns[$name] = $value; - return $this; - } - - /** - * Overloading: variable unset - * - * Proxies to values and columns - * - * @param string $name - * @throws Exception\InvalidArgumentException - * @return void - */ - public function __unset($name) - { - if (! array_key_exists($name, $this->columns)) { - throw new Exception\InvalidArgumentException( - 'The key ' . $name . ' was not found in this objects column list' - ); - } - - unset($this->columns[$name]); - } - - /** - * Overloading: variable isset - * - * Proxies to columns; does a column of that name exist? - * - * @param string $name - * @return bool - */ - public function __isset($name) - { - return array_key_exists($name, $this->columns); - } - - /** - * Overloading: variable retrieval - * - * Retrieves value by column name - * - * @param string $name - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function __get($name) - { - if (! array_key_exists($name, $this->columns)) { - throw new Exception\InvalidArgumentException( - 'The key ' . $name . ' was not found in this objects column list' - ); - } - return $this->columns[$name]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Join.php b/bundled-libs/zendframework/zend-db/src/Sql/Join.php deleted file mode 100644 index 12e85996..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Join.php +++ /dev/null @@ -1,163 +0,0 @@ -position = 0; - } - - /** - * Rewind iterator. - */ - public function rewind() - { - $this->position = 0; - } - - /** - * Return current join specification. - * - * @return array - */ - public function current() - { - return $this->joins[$this->position]; - } - - /** - * Return the current iterator index. - * - * @return int - */ - public function key() - { - return $this->position; - } - - /** - * Advance to the next JOIN specification. - */ - public function next() - { - ++$this->position; - } - - /** - * Is the iterator at a valid position? - * - * @return bool - */ - public function valid() - { - return isset($this->joins[$this->position]); - } - - /** - * @return array - */ - public function getJoins() - { - return $this->joins; - } - - /** - * @param string|array|TableIdentifier $name A table name on which to join, or a single - * element associative array, of the form alias => table, or TableIdentifier instance - * @param string|Predicate\Expression $on A specification describing the fields to join on. - * @param string|string[]|int|int[] $columns A single column name, an array - * of column names, or (a) specification(s) such as SQL_STAR representing - * the columns to join. - * @param string $type The JOIN type to use; see the JOIN_* constants. - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException for invalid $name values. - */ - public function join($name, $on, $columns = [Select::SQL_STAR], $type = Join::JOIN_INNER) - { - if (is_array($name) && (! is_string(key($name)) || count($name) !== 1)) { - throw new Exception\InvalidArgumentException( - sprintf("join() expects '%s' as a single element associative array", array_shift($name)) - ); - } - - if (! is_array($columns)) { - $columns = [$columns]; - } - - $this->joins[] = [ - 'name' => $name, - 'on' => $on, - 'columns' => $columns, - 'type' => $type ? $type : Join::JOIN_INNER - ]; - - return $this; - } - - /** - * Reset to an empty list of JOIN specifications. - * - * @return self Provides a fluent interface - */ - public function reset() - { - $this->joins = []; - return $this; - } - - /** - * Get count of attached predicates - * - * @return int - */ - public function count() - { - return count($this->joins); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Literal.php b/bundled-libs/zendframework/zend-db/src/Sql/Literal.php deleted file mode 100644 index a04b0f16..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Literal.php +++ /dev/null @@ -1,56 +0,0 @@ -literal = $literal; - } - - /** - * @param string $literal - * @return self Provides a fluent interface - */ - public function setLiteral($literal) - { - $this->literal = $literal; - return $this; - } - - /** - * @return string - */ - public function getLiteral() - { - return $this->literal; - } - - /** - * @return array - */ - public function getExpressionData() - { - return [[ - str_replace('%', '%%', $this->literal), - [], - [] - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php deleted file mode 100644 index 6d0b040b..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php +++ /dev/null @@ -1,112 +0,0 @@ -subject = $subject; - - return $this; - } - - /** - * @param string $type - * @param PlatformDecoratorInterface $decorator - * - * @return void - */ - public function setTypeDecorator($type, PlatformDecoratorInterface $decorator) - { - $this->decorators[$type] = $decorator; - } - - /** - * @param PreparableSqlInterface|SqlInterface $subject - * @return PlatformDecoratorInterface|PreparableSqlInterface|SqlInterface - */ - public function getTypeDecorator($subject) - { - foreach ($this->decorators as $type => $decorator) { - if ($subject instanceof $type) { - $decorator->setSubject($subject); - - return $decorator; - } - } - - return $subject; - } - - /** - * @return array|PlatformDecoratorInterface[] - */ - public function getDecorators() - { - return $this->decorators; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer) - { - if (! $this->subject instanceof PreparableSqlInterface) { - throw new Exception\RuntimeException( - 'The subject does not appear to implement Zend\Db\Sql\PreparableSqlInterface, thus calling ' - . 'prepareStatement() has no effect' - ); - } - - $this->getTypeDecorator($this->subject)->prepareStatement($adapter, $statementContainer); - - return $statementContainer; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function getSqlString(PlatformInterface $adapterPlatform = null) - { - if (! $this->subject instanceof SqlInterface) { - throw new Exception\RuntimeException( - 'The subject does not appear to implement Zend\Db\Sql\SqlInterface, thus calling ' - . 'prepareStatement() has no effect' - ); - } - - return $this->getTypeDecorator($this->subject)->getSqlString($adapterPlatform); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php deleted file mode 100644 index 35ddc2c7..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php +++ /dev/null @@ -1,23 +0,0 @@ -setTypeDecorator('Zend\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php deleted file mode 100644 index f1988c09..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php +++ /dev/null @@ -1,212 +0,0 @@ -isSelectContainDistinct; - } - - /** - * @param boolean $isSelectContainDistinct - */ - public function setIsSelectContainDistinct($isSelectContainDistinct) - { - $this->isSelectContainDistinct = $isSelectContainDistinct; - } - - /** - * @param Select $select - */ - public function setSubject($select) - { - $this->subject = $select; - } - - /** - * @return bool - */ - public function getSupportsLimitOffset() - { - return $this->supportsLimitOffset; - } - - /** - * @param bool $supportsLimitOffset - */ - public function setSupportsLimitOffset($supportsLimitOffset) - { - $this->supportsLimitOffset = $supportsLimitOffset; - } - - /** - * @see Select::renderTable - */ - protected function renderTable($table, $alias = null) - { - return $table . ' ' . $alias; - } - - protected function localizeVariables() - { - parent::localizeVariables(); - // set specifications - unset($this->specifications[self::LIMIT]); - unset($this->specifications[self::OFFSET]); - - $this->specifications['LIMITOFFSET'] = null; - } - - /** - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @param array $sqls - * @param array $parameters - */ - protected function processLimitOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null, - &$sqls, - &$parameters - ) { - if ($this->limit === null && $this->offset === null) { - return; - } - - if ($this->supportsLimitOffset) { - // Note: db2_prepare/db2_execute fails with positional parameters, for LIMIT & OFFSET - $limit = (int) $this->limit; - if (! $limit) { - return; - } - - $offset = (int) $this->offset; - if ($offset) { - array_push($sqls, sprintf("LIMIT %s OFFSET %s", $limit, $offset)); - return; - } - - array_push($sqls, sprintf("LIMIT %s", $limit)); - return; - } - - $selectParameters = $parameters[self::SELECT]; - - $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; - foreach ($selectParameters[0] as $i => $columnParameters) { - if ($columnParameters[0] == self::SQL_STAR - || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) - || strpos($columnParameters[0], $starSuffix) - ) { - $selectParameters[0] = [[self::SQL_STAR]]; - break; - } - - if (isset($columnParameters[1])) { - array_shift($columnParameters); - $selectParameters[0][$i] = $columnParameters; - } - } - - // first, produce column list without compound names (using the AS portion only) - array_unshift($sqls, $this->createSqlFromSpecificationAndParameters( - ['SELECT %1$s FROM (' => current($this->specifications[self::SELECT])], - $selectParameters - )); - - if (preg_match('/DISTINCT/i', $sqls[0])) { - $this->setIsSelectContainDistinct(true); - } - - if ($parameterContainer) { - // create bottom part of query, with offset and limit using row_number - $limitParamName = $driver->formatParameterName('limit'); - $offsetParamName = $driver->formatParameterName('offset'); - - array_push($sqls, sprintf( - // @codingStandardsIgnoreStart - ") AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN %s AND %s", - // @codingStandardsIgnoreEnd - $offsetParamName, - $limitParamName - )); - - if ((int) $this->offset > 0) { - $parameterContainer->offsetSet('offset', (int) $this->offset + 1); - } else { - $parameterContainer->offsetSet('offset', (int) $this->offset); - } - - $parameterContainer->offsetSet('limit', (int) $this->limit + (int) $this->offset); - } else { - if ((int) $this->offset > 0) { - $offset = (int) $this->offset + 1; - } else { - $offset = (int) $this->offset; - } - - array_push($sqls, sprintf( - // @codingStandardsIgnoreStart - ") AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN %d AND %d", - // @codingStandardsIgnoreEnd - $offset, - (int) $this->limit + (int) $this->offset - )); - } - - if (isset($sqls[self::ORDER])) { - $orderBy = $sqls[self::ORDER]; - unset($sqls[self::ORDER]); - } else { - $orderBy = ''; - } - - // add a column for row_number() using the order specification //dense_rank() - if ($this->getIsSelectContainDistinct()) { - $parameters[self::SELECT][0][] = ['DENSE_RANK() OVER (' . $orderBy . ')', 'ZEND_DB_ROWNUM']; - } else { - $parameters[self::SELECT][0][] = ['ROW_NUMBER() OVER (' . $orderBy . ')', 'ZEND_DB_ROWNUM']; - } - - $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( - $this->specifications[self::SELECT], - $parameters[self::SELECT] - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php deleted file mode 100644 index ea317653..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php +++ /dev/null @@ -1,251 +0,0 @@ - 0, - 'zerofill' => 1, - 'identity' => 2, - 'serial' => 2, - 'autoincrement' => 2, - 'comment' => 3, - 'columnformat' => 4, - 'format' => 4, - 'storage' => 5, - 'after' => 6 - ]; - - /** - * @param AlterTable $subject - * @return self Provides a fluent interface - */ - public function setSubject($subject) - { - $this->subject = $subject; - - return $this; - } - - /** - * @param string $sql - * @return array - */ - protected function getSqlInsertOffsets($sql) - { - $sqlLength = strlen($sql); - $insertStart = []; - - foreach (['NOT NULL', 'NULL', 'DEFAULT', 'UNIQUE', 'PRIMARY', 'REFERENCES'] as $needle) { - $insertPos = strpos($sql, ' ' . $needle); - - if ($insertPos !== false) { - switch ($needle) { - case 'REFERENCES': - $insertStart[2] = ! isset($insertStart[2]) ? $insertPos : $insertStart[2]; - // no break - case 'PRIMARY': - case 'UNIQUE': - $insertStart[1] = ! isset($insertStart[1]) ? $insertPos : $insertStart[1]; - // no break - default: - $insertStart[0] = ! isset($insertStart[0]) ? $insertPos : $insertStart[0]; - } - } - } - - foreach (range(0, 3) as $i) { - $insertStart[$i] = isset($insertStart[$i]) ? $insertStart[$i] : $sqlLength; - } - - return $insertStart; - } - - /** - * @param PlatformInterface $adapterPlatform - * @return array - */ - protected function processAddColumns(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - - foreach ($this->addColumns as $i => $column) { - $sql = $this->processExpression($column, $adapterPlatform); - $insertStart = $this->getSqlInsertOffsets($sql); - $columnOptions = $column->getOptions(); - - uksort($columnOptions, [$this, 'compareColumnOptions']); - - foreach ($columnOptions as $coName => $coValue) { - $insert = ''; - - if (! $coValue) { - continue; - } - - switch ($this->normalizeColumnOption($coName)) { - case 'unsigned': - $insert = ' UNSIGNED'; - $j = 0; - break; - case 'zerofill': - $insert = ' ZEROFILL'; - $j = 0; - break; - case 'identity': - case 'serial': - case 'autoincrement': - $insert = ' AUTO_INCREMENT'; - $j = 1; - break; - case 'comment': - $insert = ' COMMENT ' . $adapterPlatform->quoteValue($coValue); - $j = 2; - break; - case 'columnformat': - case 'format': - $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); - $j = 2; - break; - case 'storage': - $insert = ' STORAGE ' . strtoupper($coValue); - $j = 2; - break; - case 'after': - $insert = ' AFTER ' . $adapterPlatform->quoteIdentifier($coValue); - $j = 2; - } - - if ($insert) { - $j = isset($j) ? $j : 0; - $sql = substr_replace($sql, $insert, $insertStart[$j], 0); - $insertStartCount = count($insertStart); - for (; $j < $insertStartCount; ++$j) { - $insertStart[$j] += strlen($insert); - } - } - } - $sqls[$i] = $sql; - } - return [$sqls]; - } - - /** - * @param PlatformInterface $adapterPlatform - * @return array - */ - protected function processChangeColumns(PlatformInterface $adapterPlatform = null) - { - $sqls = []; - foreach ($this->changeColumns as $name => $column) { - $sql = $this->processExpression($column, $adapterPlatform); - $insertStart = $this->getSqlInsertOffsets($sql); - $columnOptions = $column->getOptions(); - - uksort($columnOptions, [$this, 'compareColumnOptions']); - - foreach ($columnOptions as $coName => $coValue) { - $insert = ''; - - if (! $coValue) { - continue; - } - - switch ($this->normalizeColumnOption($coName)) { - case 'unsigned': - $insert = ' UNSIGNED'; - $j = 0; - break; - case 'zerofill': - $insert = ' ZEROFILL'; - $j = 0; - break; - case 'identity': - case 'serial': - case 'autoincrement': - $insert = ' AUTO_INCREMENT'; - $j = 1; - break; - case 'comment': - $insert = ' COMMENT ' . $adapterPlatform->quoteValue($coValue); - $j = 2; - break; - case 'columnformat': - case 'format': - $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); - $j = 2; - break; - case 'storage': - $insert = ' STORAGE ' . strtoupper($coValue); - $j = 2; - break; - } - - if ($insert) { - $j = isset($j) ? $j : 0; - $sql = substr_replace($sql, $insert, $insertStart[$j], 0); - $insertStartCount = count($insertStart); - for (; $j < $insertStartCount; ++$j) { - $insertStart[$j] += strlen($insert); - } - } - } - $sqls[] = [ - $adapterPlatform->quoteIdentifier($name), - $sql - ]; - } - - return [$sqls]; - } - - /** - * @param string $name - * - * @return string - */ - private function normalizeColumnOption($name) - { - return strtolower(str_replace(['-', '_', ' '], '', $name)); - } - - /** - * - * @param string $columnA - * @param string $columnB - * - * @return int - */ - private function compareColumnOptions($columnA, $columnB) - { - $columnA = $this->normalizeColumnOption($columnA); - $columnA = isset($this->columnOptionSortOrder[$columnA]) - ? $this->columnOptionSortOrder[$columnA] : count($this->columnOptionSortOrder); - - $columnB = $this->normalizeColumnOption($columnB); - $columnB = isset($this->columnOptionSortOrder[$columnB]) - ? $this->columnOptionSortOrder[$columnB] : count($this->columnOptionSortOrder); - - return $columnA - $columnB; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php deleted file mode 100644 index fa8815a9..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php +++ /dev/null @@ -1,184 +0,0 @@ - 0, - 'zerofill' => 1, - 'identity' => 2, - 'serial' => 2, - 'autoincrement' => 2, - 'comment' => 3, - 'columnformat' => 4, - 'format' => 4, - 'storage' => 5, - ]; - - /** - * @param CreateTable $subject - * - * @return self Provides a fluent interface - */ - public function setSubject($subject) - { - $this->subject = $subject; - - return $this; - } - - /** - * @param string $sql - * @return array - */ - protected function getSqlInsertOffsets($sql) - { - $sqlLength = strlen($sql); - $insertStart = []; - - foreach (['NOT NULL', 'NULL', 'DEFAULT', 'UNIQUE', 'PRIMARY', 'REFERENCES'] as $needle) { - $insertPos = strpos($sql, ' ' . $needle); - - if ($insertPos !== false) { - switch ($needle) { - case 'REFERENCES': - $insertStart[2] = ! isset($insertStart[2]) ? $insertPos : $insertStart[2]; - // no break - case 'PRIMARY': - case 'UNIQUE': - $insertStart[1] = ! isset($insertStart[1]) ? $insertPos : $insertStart[1]; - // no break - default: - $insertStart[0] = ! isset($insertStart[0]) ? $insertPos : $insertStart[0]; - } - } - } - - foreach (range(0, 3) as $i) { - $insertStart[$i] = isset($insertStart[$i]) ? $insertStart[$i] : $sqlLength; - } - - return $insertStart; - } - - /** - * {@inheritDoc} - */ - protected function processColumns(PlatformInterface $platform = null) - { - if (! $this->columns) { - return; - } - - $sqls = []; - - foreach ($this->columns as $i => $column) { - $sql = $this->processExpression($column, $platform); - $insertStart = $this->getSqlInsertOffsets($sql); - $columnOptions = $column->getOptions(); - - uksort($columnOptions, [$this, 'compareColumnOptions']); - - foreach ($columnOptions as $coName => $coValue) { - $insert = ''; - - if (! $coValue) { - continue; - } - - switch ($this->normalizeColumnOption($coName)) { - case 'unsigned': - $insert = ' UNSIGNED'; - $j = 0; - break; - case 'zerofill': - $insert = ' ZEROFILL'; - $j = 0; - break; - case 'identity': - case 'serial': - case 'autoincrement': - $insert = ' AUTO_INCREMENT'; - $j = 1; - break; - case 'comment': - $insert = ' COMMENT ' . $platform->quoteValue($coValue); - $j = 2; - break; - case 'columnformat': - case 'format': - $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); - $j = 2; - break; - case 'storage': - $insert = ' STORAGE ' . strtoupper($coValue); - $j = 2; - break; - } - - if ($insert) { - $j = isset($j) ? $j : 0; - $sql = substr_replace($sql, $insert, $insertStart[$j], 0); - $insertStartCount = count($insertStart); - for (; $j < $insertStartCount; ++$j) { - $insertStart[$j] += strlen($insert); - } - } - } - - $sqls[$i] = $sql; - } - - return [$sqls]; - } - - /** - * @param string $name - * - * @return string - */ - private function normalizeColumnOption($name) - { - return strtolower(str_replace(['-', '_', ' '], '', $name)); - } - - /** - * - * @param string $columnA - * @param string $columnB - * - * @return int - */ - private function compareColumnOptions($columnA, $columnB) - { - $columnA = $this->normalizeColumnOption($columnA); - $columnA = isset($this->columnOptionSortOrder[$columnA]) - ? $this->columnOptionSortOrder[$columnA] : count($this->columnOptionSortOrder); - - $columnB = $this->normalizeColumnOption($columnB); - $columnB = isset($this->columnOptionSortOrder[$columnB]) - ? $this->columnOptionSortOrder[$columnB] : count($this->columnOptionSortOrder); - - return $columnA - $columnB; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php deleted file mode 100644 index 3e1611b8..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php +++ /dev/null @@ -1,22 +0,0 @@ -setTypeDecorator('Zend\Db\Sql\Select', new SelectDecorator()); - $this->setTypeDecorator('Zend\Db\Sql\Ddl\CreateTable', new Ddl\CreateTableDecorator()); - $this->setTypeDecorator('Zend\Db\Sql\Ddl\AlterTable', new Ddl\AlterTableDecorator()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php deleted file mode 100644 index 3ef7655c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php +++ /dev/null @@ -1,77 +0,0 @@ -subject = $select; - } - - protected function localizeVariables() - { - parent::localizeVariables(); - if ($this->limit === null && $this->offset !== null) { - $this->specifications[self::LIMIT] = 'LIMIT 18446744073709551615'; - } - } - - protected function processLimit( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->limit === null && $this->offset !== null) { - return ['']; - } - if ($this->limit === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName($paramPrefix . 'limit')]; - } - - return [$this->limit]; - } - - protected function processOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->offset === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName($paramPrefix . 'offset')]; - } - - return [$this->offset]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php deleted file mode 100644 index bf1dc31d..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php +++ /dev/null @@ -1,20 +0,0 @@ -setTypeDecorator('Zend\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php deleted file mode 100644 index 9961b4dc..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php +++ /dev/null @@ -1,155 +0,0 @@ -subject = $select; - } - - /** - * @see \Zend\Db\Sql\Select::renderTable - */ - protected function renderTable($table, $alias = null) - { - return $table . ($alias ? ' ' . $alias : ''); - } - - protected function localizeVariables() - { - parent::localizeVariables(); - unset($this->specifications[self::LIMIT]); - unset($this->specifications[self::OFFSET]); - - $this->specifications['LIMITOFFSET'] = null; - } - - /** - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @param array $sqls - * @param array $parameters - * @return null - */ - protected function processLimitOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null, - &$sqls = [], - &$parameters = [] - ) { - if ($this->limit === null && $this->offset === null) { - return; - } - - $selectParameters = $parameters[self::SELECT]; - $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; - - foreach ($selectParameters[0] as $i => $columnParameters) { - if ($columnParameters[0] == self::SQL_STAR - || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) - || strpos($columnParameters[0], $starSuffix) - ) { - $selectParameters[0] = [[self::SQL_STAR]]; - break; - } - - if (isset($columnParameters[1])) { - array_shift($columnParameters); - $selectParameters[0][$i] = $columnParameters; - } - } - - if ($this->offset === null) { - $this->offset = 0; - } - - // first, produce column list without compound names (using the AS portion only) - array_unshift($sqls, $this->createSqlFromSpecificationAndParameters([ - 'SELECT %1$s FROM (SELECT b.%1$s, rownum b_rownum FROM (' => current($this->specifications[self::SELECT]), - ], $selectParameters)); - - if ($parameterContainer) { - $number = $this->processInfo['subselectCount'] ? $this->processInfo['subselectCount'] : ''; - - if ($this->limit === null) { - array_push( - $sqls, - ') b ) WHERE b_rownum > (:offset' . $number . ')' - ); - $parameterContainer->offsetSet( - 'offset' . $number, - $this->offset, - $parameterContainer::TYPE_INTEGER - ); - } else { - // create bottom part of query, with offset and limit using row_number - array_push( - $sqls, - ') b WHERE rownum <= (:offset' - . $number - . '+:limit' - . $number - . ')) WHERE b_rownum >= (:offset' - . $number - . ' + 1)' - ); - $parameterContainer->offsetSet( - 'offset' . $number, - $this->offset, - $parameterContainer::TYPE_INTEGER - ); - $parameterContainer->offsetSet( - 'limit' . $number, - $this->limit, - $parameterContainer::TYPE_INTEGER - ); - } - $this->processInfo['subselectCount']++; - } else { - if ($this->limit === null) { - array_push($sqls, ') b ) WHERE b_rownum > (' . (int) $this->offset . ')'); - } else { - array_push( - $sqls, - ') b WHERE rownum <= (' - . (int) $this->offset - . '+' - . (int) $this->limit - . ')) WHERE b_rownum >= (' - . (int) $this->offset - . ' + 1)' - ); - } - } - - $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( - $this->specifications[self::SELECT], - $parameters[self::SELECT] - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Platform.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Platform.php deleted file mode 100644 index e702caac..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Platform.php +++ /dev/null @@ -1,173 +0,0 @@ -defaultPlatform = $adapter->getPlatform(); - - $mySqlPlatform = new Mysql\Mysql(); - $sqlServerPlatform = new SqlServer\SqlServer(); - $oraclePlatform = new Oracle\Oracle(); - $ibmDb2Platform = new IbmDb2\IbmDb2(); - $sqlitePlatform = new Sqlite\Sqlite(); - - $this->decorators['mysql'] = $mySqlPlatform->getDecorators(); - $this->decorators['sqlserver'] = $sqlServerPlatform->getDecorators(); - $this->decorators['oracle'] = $oraclePlatform->getDecorators(); - $this->decorators['ibmdb2'] = $ibmDb2Platform->getDecorators(); - $this->decorators['sqlite'] = $sqlitePlatform->getDecorators(); - } - - /** - * @param string $type - * @param PlatformDecoratorInterface $decorator - * @param AdapterInterface|PlatformInterface $adapterOrPlatform - */ - public function setTypeDecorator($type, PlatformDecoratorInterface $decorator, $adapterOrPlatform = null) - { - $platformName = $this->resolvePlatformName($adapterOrPlatform); - $this->decorators[$platformName][$type] = $decorator; - } - - /** - * @param PreparableSqlInterface|SqlInterface $subject - * @param AdapterInterface|PlatformInterface|null $adapterOrPlatform - * @return PlatformDecoratorInterface|PreparableSqlInterface|SqlInterface - */ - public function getTypeDecorator($subject, $adapterOrPlatform = null) - { - $platformName = $this->resolvePlatformName($adapterOrPlatform); - - if (isset($this->decorators[$platformName])) { - foreach ($this->decorators[$platformName] as $type => $decorator) { - if ($subject instanceof $type && is_a($decorator, $type, true)) { - $decorator->setSubject($subject); - return $decorator; - } - } - } - - return $subject; - } - - /** - * @return array|PlatformDecoratorInterface[] - */ - public function getDecorators() - { - $platformName = $this->resolvePlatformName($this->getDefaultPlatform()); - return $this->decorators[$platformName]; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer) - { - if (! $this->subject instanceof PreparableSqlInterface) { - throw new Exception\RuntimeException( - 'The subject does not appear to implement Zend\Db\Sql\PreparableSqlInterface, thus calling ' - . 'prepareStatement() has no effect' - ); - } - - $this->getTypeDecorator($this->subject, $adapter)->prepareStatement($adapter, $statementContainer); - - return $statementContainer; - } - - /** - * {@inheritDoc} - * - * @throws Exception\RuntimeException - */ - public function getSqlString(PlatformInterface $adapterPlatform = null) - { - if (! $this->subject instanceof SqlInterface) { - throw new Exception\RuntimeException( - 'The subject does not appear to implement Zend\Db\Sql\SqlInterface, thus calling ' - . 'prepareStatement() has no effect' - ); - } - - $adapterPlatform = $this->resolvePlatform($adapterPlatform); - - return $this->getTypeDecorator($this->subject, $adapterPlatform)->getSqlString($adapterPlatform); - } - - protected function resolvePlatformName($adapterOrPlatform) - { - $platformName = $this->resolvePlatform($adapterOrPlatform)->getName(); - return str_replace([' ', '_'], '', strtolower($platformName)); - } - /** - * @param null|PlatformInterface|AdapterInterface $adapterOrPlatform - * - * @return PlatformInterface - * - * @throws Exception\InvalidArgumentException - */ - protected function resolvePlatform($adapterOrPlatform) - { - if (! $adapterOrPlatform) { - return $this->getDefaultPlatform(); - } - - if ($adapterOrPlatform instanceof AdapterInterface) { - return $adapterOrPlatform->getPlatform(); - } - - if ($adapterOrPlatform instanceof PlatformInterface) { - return $adapterOrPlatform; - } - - throw new Exception\InvalidArgumentException(sprintf( - '$adapterOrPlatform should be null, %s, or %s', - 'Zend\Db\Adapter\AdapterInterface', - 'Zend\Db\Adapter\Platform\PlatformInterface' - )); - } - - /** - * @return PlatformInterface - * - * @throws Exception\RuntimeException - */ - protected function getDefaultPlatform() - { - if (! $this->defaultPlatform) { - throw new Exception\RuntimeException('$this->defaultPlatform was not set'); - } - - return $this->defaultPlatform; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php deleted file mode 100644 index f06c4340..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php +++ /dev/null @@ -1,20 +0,0 @@ -subject = $subject; - return $this; - } - - /** - * @param PlatformInterface $adapterPlatform - * @return array - */ - protected function processTable(PlatformInterface $adapterPlatform = null) - { - $table = ($this->isTemporary ? '#' : '') . ltrim($this->table, '#'); - return [ - '', - $adapterPlatform->quoteIdentifier($table), - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php deleted file mode 100644 index 642d10b5..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php +++ /dev/null @@ -1,128 +0,0 @@ -subject = $select; - } - - protected function localizeVariables() - { - parent::localizeVariables(); - // set specifications - unset($this->specifications[self::LIMIT]); - unset($this->specifications[self::OFFSET]); - - $this->specifications['LIMITOFFSET'] = null; - } - - /** - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @param $sqls - * @param $parameters - * @return null - */ - protected function processLimitOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null, - &$sqls, - &$parameters - ) { - if ($this->limit === null && $this->offset === null) { - return; - } - - $selectParameters = $parameters[self::SELECT]; - - /** if this is a DISTINCT query then real SELECT part goes to second element in array **/ - $parameterIndex = 0; - if ($selectParameters[0] === 'DISTINCT') { - unset($selectParameters[0]); - $selectParameters = array_values($selectParameters); - $parameterIndex = 1; - } - - $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; - foreach ($selectParameters[0] as $i => $columnParameters) { - if ($columnParameters[0] == self::SQL_STAR - || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) - || strpos($columnParameters[0], $starSuffix) - ) { - $selectParameters[0] = [[self::SQL_STAR]]; - break; - } - if (isset($columnParameters[1])) { - array_shift($columnParameters); - $selectParameters[0][$i] = $columnParameters; - } - } - - // first, produce column list without compound names (using the AS portion only) - array_unshift($sqls, $this->createSqlFromSpecificationAndParameters( - ['SELECT %1$s FROM (' => current($this->specifications[self::SELECT])], - $selectParameters - )); - - if ($parameterContainer) { - // create bottom part of query, with offset and limit using row_number - $limitParamName = $driver->formatParameterName('limit'); - $offsetParamName = $driver->formatParameterName('offset'); - $offsetForSumParamName = $driver->formatParameterName('offsetForSum'); - // @codingStandardsIgnoreStart - array_push($sqls, ') AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ' - . $offsetParamName . '+1 AND ' . $limitParamName . '+' . $offsetForSumParamName); - // @codingStandardsIgnoreEnd - $parameterContainer->offsetSet('offset', $this->offset); - $parameterContainer->offsetSet('limit', $this->limit); - $parameterContainer->offsetSetReference('offsetForSum', 'offset'); - } else { - // @codingStandardsIgnoreStart - array_push($sqls, ') AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ' - . (int) $this->offset . '+1 AND ' - . (int) $this->limit . '+' . (int) $this->offset); - // @codingStandardsIgnoreEnd - } - - if (isset($sqls[self::ORDER])) { - $orderBy = $sqls[self::ORDER]; - unset($sqls[self::ORDER]); - } else { - $orderBy = 'ORDER BY (SELECT 1)'; - } - - // add a column for row_number() using the order specification - $parameters[self::SELECT][$parameterIndex][] = ['ROW_NUMBER() OVER (' . $orderBy . ')', '[__ZEND_ROW_NUMBER]']; - - $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( - $this->specifications[self::SELECT], - $parameters[self::SELECT] - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php deleted file mode 100644 index 0dc383d0..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php +++ /dev/null @@ -1,21 +0,0 @@ -setTypeDecorator('Zend\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); - $this->setTypeDecorator('Zend\Db\Sql\Ddl\CreateTable', new Ddl\CreateTableDecorator()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php deleted file mode 100644 index a1b3d6c5..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php +++ /dev/null @@ -1,105 +0,0 @@ -subject = $select; - - return $this; - } - - /** - * {@inheritDoc} - */ - protected function localizeVariables() - { - parent::localizeVariables(); - $this->specifications[self::COMBINE] = '%1$s %2$s'; - } - - /** - * {@inheritDoc} - */ - protected function processStatementStart( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return ''; - } - - protected function processLimit( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->limit === null && $this->offset !== null) { - return ['']; - } - if ($this->limit === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName('limit')]; - } - - return [$this->limit]; - } - - protected function processOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->offset === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName('offset')]; - } - - return [$this->offset]; - } - - /** - * {@inheritDoc} - */ - protected function processStatementEnd( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return ''; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php b/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php deleted file mode 100644 index 00712dde..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php +++ /dev/null @@ -1,25 +0,0 @@ -setTypeDecorator('Zend\Db\Sql\Select', new SelectDecorator()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Between.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Between.php deleted file mode 100644 index 4b1545eb..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Between.php +++ /dev/null @@ -1,147 +0,0 @@ -setIdentifier($identifier); - } - if ($minValue !== null) { - $this->setMinValue($minValue); - } - if ($maxValue !== null) { - $this->setMaxValue($maxValue); - } - } - - /** - * Set identifier for comparison - * - * @param string $identifier - * @return self Provides a fluent interface - */ - public function setIdentifier($identifier) - { - $this->identifier = $identifier; - return $this; - } - - /** - * Get identifier of comparison - * - * @return null|string - */ - public function getIdentifier() - { - return $this->identifier; - } - - /** - * Set minimum boundary for comparison - * - * @param int|float|string $minValue - * @return self Provides a fluent interface - */ - public function setMinValue($minValue) - { - $this->minValue = $minValue; - return $this; - } - - /** - * Get minimum boundary for comparison - * - * @return null|int|float|string - */ - public function getMinValue() - { - return $this->minValue; - } - - /** - * Set maximum boundary for comparison - * - * @param int|float|string $maxValue - * @return self Provides a fluent interface - */ - public function setMaxValue($maxValue) - { - $this->maxValue = $maxValue; - return $this; - } - - /** - * Get maximum boundary for comparison - * - * @return null|int|float|string - */ - public function getMaxValue() - { - return $this->maxValue; - } - - /** - * Set specification string to use in forming SQL predicate - * - * @param string $specification - * @return self Provides a fluent interface - */ - public function setSpecification($specification) - { - $this->specification = $specification; - return $this; - } - - /** - * Get specification string to use in forming SQL predicate - * - * @return string - */ - public function getSpecification() - { - return $this->specification; - } - - /** - * Return "where" parts - * - * @return array - */ - public function getExpressionData() - { - list($values[], $types[]) = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); - list($values[], $types[]) = $this->normalizeArgument($this->minValue, self::TYPE_VALUE); - list($values[], $types[]) = $this->normalizeArgument($this->maxValue, self::TYPE_VALUE); - return [ - [ - $this->getSpecification(), - $values, - $types, - ], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Expression.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Expression.php deleted file mode 100644 index e9b5363f..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Expression.php +++ /dev/null @@ -1,30 +0,0 @@ -setExpression($expression); - } - - $this->setParameters(is_array($valueParameter) ? $valueParameter : array_slice(func_get_args(), 1)); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/In.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/In.php deleted file mode 100644 index 0c62189c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/In.php +++ /dev/null @@ -1,140 +0,0 @@ -setIdentifier($identifier); - } - if ($valueSet !== null) { - $this->setValueSet($valueSet); - } - } - - /** - * Set identifier for comparison - * - * @param string|array $identifier - * @return self Provides a fluent interface - */ - public function setIdentifier($identifier) - { - $this->identifier = $identifier; - - return $this; - } - - /** - * Get identifier of comparison - * - * @return null|string|array - */ - public function getIdentifier() - { - return $this->identifier; - } - - /** - * Set set of values for IN comparison - * - * @param array|Select $valueSet - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setValueSet($valueSet) - { - if (! is_array($valueSet) && ! $valueSet instanceof Select) { - throw new Exception\InvalidArgumentException( - '$valueSet must be either an array or a Zend\Db\Sql\Select object, ' . gettype($valueSet) . ' given' - ); - } - $this->valueSet = $valueSet; - - return $this; - } - - /** - * Gets set of values in IN comparison - * - * @return array|Select - */ - public function getValueSet() - { - return $this->valueSet; - } - - /** - * Return array of parts for where statement - * - * @return array - */ - public function getExpressionData() - { - $identifier = $this->getIdentifier(); - $values = $this->getValueSet(); - $replacements = []; - - if (is_array($identifier)) { - $countIdentifier = count($identifier); - $identifierSpecFragment = '(' . implode(', ', array_fill(0, $countIdentifier, '%s')) . ')'; - $types = array_fill(0, $countIdentifier, self::TYPE_IDENTIFIER); - $replacements = $identifier; - } else { - $identifierSpecFragment = '%s'; - $replacements[] = $identifier; - $types = [self::TYPE_IDENTIFIER]; - } - - if ($values instanceof Select) { - $specification = vsprintf( - $this->specification, - [$identifierSpecFragment, '%s'] - ); - $replacements[] = $values; - $types[] = self::TYPE_VALUE; - } else { - foreach ($values as $argument) { - list($replacements[], $types[]) = $this->normalizeArgument($argument, self::TYPE_VALUE); - } - $countValues = count($values); - $valuePlaceholders = $countValues > 0 ? array_fill(0, $countValues, '%s') : []; - $specification = vsprintf( - $this->specification, - [$identifierSpecFragment, '(' . implode(', ', $valuePlaceholders) . ')'] - ); - } - - return [[ - $specification, - $replacements, - $types, - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php deleted file mode 100644 index e42c9aa5..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php +++ /dev/null @@ -1,15 +0,0 @@ -setIdentifier($identifier); - } - } - - /** - * Set identifier for comparison - * - * @param string $identifier - * @return self Provides a fluent interface - */ - public function setIdentifier($identifier) - { - $this->identifier = $identifier; - return $this; - } - - /** - * Get identifier of comparison - * - * @return null|string - */ - public function getIdentifier() - { - return $this->identifier; - } - - /** - * Set specification string to use in forming SQL predicate - * - * @param string $specification - * @return self Provides a fluent interface - */ - public function setSpecification($specification) - { - $this->specification = $specification; - return $this; - } - - /** - * Get specification string to use in forming SQL predicate - * - * @return string - */ - public function getSpecification() - { - return $this->specification; - } - - /** - * Get parts for where statement - * - * @return array - */ - public function getExpressionData() - { - $identifier = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); - return [[ - $this->getSpecification(), - [$identifier[0]], - [$identifier[1]], - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Like.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Like.php deleted file mode 100644 index 2f1ffde7..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Like.php +++ /dev/null @@ -1,114 +0,0 @@ -setIdentifier($identifier); - } - if ($like) { - $this->setLike($like); - } - } - - /** - * @param string $identifier - * @return self Provides a fluent interface - */ - public function setIdentifier($identifier) - { - $this->identifier = $identifier; - return $this; - } - - /** - * @return string - */ - public function getIdentifier() - { - return $this->identifier; - } - - /** - * @param string $like - * @return self Provides a fluent interface - */ - public function setLike($like) - { - $this->like = $like; - return $this; - } - - /** - * @return string - */ - public function getLike() - { - return $this->like; - } - - /** - * @param string $specification - * @return self Provides a fluent interface - */ - public function setSpecification($specification) - { - $this->specification = $specification; - return $this; - } - - /** - * @return string - */ - public function getSpecification() - { - return $this->specification; - } - - /** - * @return array - */ - public function getExpressionData() - { - list($values[], $types[]) = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); - list($values[], $types[]) = $this->normalizeArgument($this->like, self::TYPE_VALUE); - return [ - [ - $this->specification, - $values, - $types, - ] - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Literal.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Literal.php deleted file mode 100644 index d4b509fc..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Literal.php +++ /dev/null @@ -1,16 +0,0 @@ -'; - const OP_GT = '>'; - - const OPERATOR_GREATER_THAN_OR_EQUAL_TO = '>='; - const OP_GTE = '>='; - - /** - * {@inheritDoc} - */ - protected $allowedTypes = [ - self::TYPE_IDENTIFIER, - self::TYPE_VALUE, - ]; - - /** - * @var int|float|bool|string - */ - protected $left; - - /** - * @var int|float|bool|string - */ - protected $right; - - /** - * @var string - */ - protected $leftType = self::TYPE_IDENTIFIER; - - /** - * @var string - */ - protected $rightType = self::TYPE_VALUE; - - /** - * @var string - */ - protected $operator = self::OPERATOR_EQUAL_TO; - - /** - * Constructor - * - * @param int|float|bool|string $left - * @param string $operator - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - */ - public function __construct( - $left = null, - $operator = self::OPERATOR_EQUAL_TO, - $right = null, - $leftType = self::TYPE_IDENTIFIER, - $rightType = self::TYPE_VALUE - ) { - if ($left !== null) { - $this->setLeft($left); - } - - if ($operator !== self::OPERATOR_EQUAL_TO) { - $this->setOperator($operator); - } - - if ($right !== null) { - $this->setRight($right); - } - - if ($leftType !== self::TYPE_IDENTIFIER) { - $this->setLeftType($leftType); - } - - if ($rightType !== self::TYPE_VALUE) { - $this->setRightType($rightType); - } - } - - /** - * Set left side of operator - * - * @param int|float|bool|string $left - * - * @return self Provides a fluent interface - */ - public function setLeft($left) - { - $this->left = $left; - - if (is_array($left)) { - $left = $this->normalizeArgument($left, $this->leftType); - $this->leftType = $left[1]; - } - - return $this; - } - - /** - * Get left side of operator - * - * @return int|float|bool|string - */ - public function getLeft() - { - return $this->left; - } - - /** - * Set parameter type for left side of operator - * - * @param string $type TYPE_IDENTIFIER or TYPE_VALUE {@see allowedTypes} - * - * @return self Provides a fluent interface - * - * @throws Exception\InvalidArgumentException - */ - public function setLeftType($type) - { - if (! in_array($type, $this->allowedTypes)) { - throw new Exception\InvalidArgumentException(sprintf( - 'Invalid type "%s" provided; must be of type "%s" or "%s"', - $type, - __CLASS__ . '::TYPE_IDENTIFIER', - __CLASS__ . '::TYPE_VALUE' - )); - } - - $this->leftType = $type; - - return $this; - } - - /** - * Get parameter type on left side of operator - * - * @return string - */ - public function getLeftType() - { - return $this->leftType; - } - - /** - * Set operator string - * - * @param string $operator - * @return self Provides a fluent interface - */ - public function setOperator($operator) - { - $this->operator = $operator; - - return $this; - } - - /** - * Get operator string - * - * @return string - */ - public function getOperator() - { - return $this->operator; - } - - /** - * Set right side of operator - * - * @param int|float|bool|string $right - * - * @return self Provides a fluent interface - */ - public function setRight($right) - { - $this->right = $right; - - if (is_array($right)) { - $right = $this->normalizeArgument($right, $this->rightType); - $this->rightType = $right[1]; - } - - return $this; - } - - /** - * Get right side of operator - * - * @return int|float|bool|string - */ - public function getRight() - { - return $this->right; - } - - /** - * Set parameter type for right side of operator - * - * @param string $type TYPE_IDENTIFIER or TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setRightType($type) - { - if (! in_array($type, $this->allowedTypes)) { - throw new Exception\InvalidArgumentException(sprintf( - 'Invalid type "%s" provided; must be of type "%s" or "%s"', - $type, - __CLASS__ . '::TYPE_IDENTIFIER', - __CLASS__ . '::TYPE_VALUE' - )); - } - - $this->rightType = $type; - - return $this; - } - - /** - * Get parameter type on right side of operator - * - * @return string - */ - public function getRightType() - { - return $this->rightType; - } - - /** - * Get predicate parts for where statement - * - * @return array - */ - public function getExpressionData() - { - list($values[], $types[]) = $this->normalizeArgument($this->left, $this->leftType); - list($values[], $types[]) = $this->normalizeArgument($this->right, $this->rightType); - - return [[ - '%s ' . $this->operator . ' %s', - $values, - $types - ]]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Predicate.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Predicate.php deleted file mode 100644 index a7d901d7..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/Predicate.php +++ /dev/null @@ -1,455 +0,0 @@ -setUnnest($this); - $this->addPredicate($predicateSet, ($this->nextPredicateCombineOperator) ?: $this->defaultCombination); - $this->nextPredicateCombineOperator = null; - return $predicateSet; - } - - /** - * Indicate what predicate will be unnested - * - * @param Predicate $predicate - * @return void - */ - public function setUnnest(Predicate $predicate) - { - $this->unnest = $predicate; - } - - /** - * Indicate end of nested predicate - * - * @return Predicate - * @throws RuntimeException - */ - public function unnest() - { - if ($this->unnest === null) { - throw new RuntimeException('Not nested'); - } - $unnest = $this->unnest; - $this->unnest = null; - return $unnest; - } - - /** - * Create "Equal To" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function equalTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) - { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_EQUAL_TO, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Not Equal To" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function notEqualTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) - { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_NOT_EQUAL_TO, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Less Than" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function lessThan($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) - { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_LESS_THAN, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Greater Than" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function greaterThan($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) - { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_GREATER_THAN, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Less Than Or Equal To" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function lessThanOrEqualTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) - { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_LESS_THAN_OR_EQUAL_TO, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Greater Than Or Equal To" predicate - * - * Utilizes Operator predicate - * - * @param int|float|bool|string $left - * @param int|float|bool|string $right - * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} - * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} - * @return self Provides a fluent interface - */ - public function greaterThanOrEqualTo( - $left, - $right, - $leftType = self::TYPE_IDENTIFIER, - $rightType = self::TYPE_VALUE - ) { - $this->addPredicate( - new Operator($left, Operator::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $right, $leftType, $rightType), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Like" predicate - * - * Utilizes Like predicate - * - * @param string|Expression $identifier - * @param string $like - * @return self Provides a fluent interface - */ - public function like($identifier, $like) - { - $this->addPredicate( - new Like($identifier, $like), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - /** - * Create "notLike" predicate - * - * Utilizes In predicate - * - * @param string|Expression $identifier - * @param string $notLike - * @return self Provides a fluent interface - */ - public function notLike($identifier, $notLike) - { - $this->addPredicate( - new NotLike($identifier, $notLike), - ($this->nextPredicateCombineOperator) ? : $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - return $this; - } - - /** - * Create an expression, with parameter placeholders - * - * @param $expression - * @param $parameters - * @return self Provides a fluent interface - */ - public function expression($expression, $parameters = null) - { - $this->addPredicate( - new Expression($expression, $parameters), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "Literal" predicate - * - * Literal predicate, for parameters, use expression() - * - * @param string $literal - * @return self Provides a fluent interface - */ - public function literal($literal) - { - // process deprecated parameters from previous literal($literal, $parameters = null) signature - if (func_num_args() >= 2) { - $parameters = func_get_arg(1); - $predicate = new Expression($literal, $parameters); - } - - // normal workflow for "Literals" here - if (! isset($predicate)) { - $predicate = new Literal($literal); - } - - $this->addPredicate( - $predicate, - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "IS NULL" predicate - * - * Utilizes IsNull predicate - * - * @param string|Expression $identifier - * @return self Provides a fluent interface - */ - public function isNull($identifier) - { - $this->addPredicate( - new IsNull($identifier), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "IS NOT NULL" predicate - * - * Utilizes IsNotNull predicate - * - * @param string|Expression $identifier - * @return self Provides a fluent interface - */ - public function isNotNull($identifier) - { - $this->addPredicate( - new IsNotNull($identifier), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "IN" predicate - * - * Utilizes In predicate - * - * @param string|Expression $identifier - * @param array|\Zend\Db\Sql\Select $valueSet - * @return self Provides a fluent interface - */ - public function in($identifier, $valueSet = null) - { - $this->addPredicate( - new In($identifier, $valueSet), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "NOT IN" predicate - * - * Utilizes NotIn predicate - * - * @param string|Expression $identifier - * @param array|\Zend\Db\Sql\Select $valueSet - * @return self Provides a fluent interface - */ - public function notIn($identifier, $valueSet = null) - { - $this->addPredicate( - new NotIn($identifier, $valueSet), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "between" predicate - * - * Utilizes Between predicate - * - * @param string|Expression $identifier - * @param int|float|string $minValue - * @param int|float|string $maxValue - * @return self Provides a fluent interface - */ - public function between($identifier, $minValue, $maxValue) - { - $this->addPredicate( - new Between($identifier, $minValue, $maxValue), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Create "NOT BETWEEN" predicate - * - * Utilizes NotBetween predicate - * - * @param string|Expression $identifier - * @param int|float|string $minValue - * @param int|float|string $maxValue - * @return self Provides a fluent interface - */ - public function notBetween($identifier, $minValue, $maxValue) - { - $this->addPredicate( - new NotBetween($identifier, $minValue, $maxValue), - ($this->nextPredicateCombineOperator) ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Use given predicate directly - * - * Contrary to {@link addPredicate()} this method respects formerly set - * AND / OR combination operator, thus allowing generic predicates to be - * used fluently within where chains as any other concrete predicate. - * - * @param PredicateInterface $predicate - * @return self Provides a fluent interface - */ - public function predicate(PredicateInterface $predicate) - { - $this->addPredicate( - $predicate, - $this->nextPredicateCombineOperator ?: $this->defaultCombination - ); - $this->nextPredicateCombineOperator = null; - - return $this; - } - - /** - * Overloading - * - * Overloads "or", "and", "nest", and "unnest" - * - * @param string $name - * @return self Provides a fluent interface - */ - public function __get($name) - { - switch (strtolower($name)) { - case 'or': - $this->nextPredicateCombineOperator = self::OP_OR; - break; - case 'and': - $this->nextPredicateCombineOperator = self::OP_AND; - break; - case 'nest': - return $this->nest(); - case 'unnest': - return $this->unnest(); - } - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php deleted file mode 100644 index b8d6c84b..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -defaultCombination = $defaultCombination; - if ($predicates) { - foreach ($predicates as $predicate) { - $this->addPredicate($predicate); - } - } - } - - /** - * Add predicate to set - * - * @param PredicateInterface $predicate - * @param string $combination - * @return self Provides a fluent interface - */ - public function addPredicate(PredicateInterface $predicate, $combination = null) - { - if ($combination === null || ! in_array($combination, [self::OP_AND, self::OP_OR])) { - $combination = $this->defaultCombination; - } - - if ($combination == self::OP_OR) { - $this->orPredicate($predicate); - return $this; - } - - $this->andPredicate($predicate); - return $this; - } - - /** - * Add predicates to set - * - * @param PredicateInterface|\Closure|string|array $predicates - * @param string $combination - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function addPredicates($predicates, $combination = self::OP_AND) - { - if ($predicates === null) { - throw new Exception\InvalidArgumentException('Predicate cannot be null'); - } - if ($predicates instanceof PredicateInterface) { - $this->addPredicate($predicates, $combination); - return $this; - } - if ($predicates instanceof \Closure) { - $predicates($this); - return $this; - } - if (is_string($predicates)) { - // String $predicate should be passed as an expression - $predicates = (strpos($predicates, Expression::PLACEHOLDER) !== false) - ? new Expression($predicates) : new Literal($predicates); - $this->addPredicate($predicates, $combination); - return $this; - } - if (is_array($predicates)) { - foreach ($predicates as $pkey => $pvalue) { - // loop through predicates - if (is_string($pkey)) { - if (strpos($pkey, '?') !== false) { - // First, process strings that the abstraction replacement character ? - // as an Expression predicate - $predicates = new Expression($pkey, $pvalue); - } elseif ($pvalue === null) { - // Otherwise, if still a string, do something intelligent with the PHP type provided - // map PHP null to SQL IS NULL expression - $predicates = new IsNull($pkey); - } elseif (is_array($pvalue)) { - // if the value is an array, assume IN() is desired - $predicates = new In($pkey, $pvalue); - } elseif ($pvalue instanceof PredicateInterface) { - throw new Exception\InvalidArgumentException( - 'Using Predicate must not use string keys' - ); - } else { - // otherwise assume that array('foo' => 'bar') means "foo" = 'bar' - $predicates = new Operator($pkey, Operator::OP_EQ, $pvalue); - } - } elseif ($pvalue instanceof PredicateInterface) { - // Predicate type is ok - $predicates = $pvalue; - } else { - // must be an array of expressions (with int-indexed array) - $predicates = (strpos($pvalue, Expression::PLACEHOLDER) !== false) - ? new Expression($pvalue) : new Literal($pvalue); - } - $this->addPredicate($predicates, $combination); - } - } - return $this; - } - - /** - * Return the predicates - * - * @return PredicateInterface[] - */ - public function getPredicates() - { - return $this->predicates; - } - - /** - * Add predicate using OR operator - * - * @param PredicateInterface $predicate - * @return self Provides a fluent interface - */ - public function orPredicate(PredicateInterface $predicate) - { - $this->predicates[] = [self::OP_OR, $predicate]; - return $this; - } - - /** - * Add predicate using AND operator - * - * @param PredicateInterface $predicate - * @return self Provides a fluent interface - */ - public function andPredicate(PredicateInterface $predicate) - { - $this->predicates[] = [self::OP_AND, $predicate]; - return $this; - } - - /** - * Get predicate parts for where statement - * - * @return array - */ - public function getExpressionData() - { - $parts = []; - for ($i = 0, $count = count($this->predicates); $i < $count; $i++) { - /** @var $predicate PredicateInterface */ - $predicate = $this->predicates[$i][1]; - - if ($predicate instanceof PredicateSet) { - $parts[] = '('; - } - - $parts = array_merge($parts, $predicate->getExpressionData()); - - if ($predicate instanceof PredicateSet) { - $parts[] = ')'; - } - - if (isset($this->predicates[$i + 1])) { - $parts[] = sprintf(' %s ', $this->predicates[$i + 1][0]); - } - } - return $parts; - } - - /** - * Get count of attached predicates - * - * @return int - */ - public function count() - { - return count($this->predicates); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/PreparableSqlInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/PreparableSqlInterface.php deleted file mode 100644 index f937e07b..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/PreparableSqlInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - '%1$s', - self::SELECT => [ - 'SELECT %1$s FROM %2$s' => [ - [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], - null - ], - 'SELECT %1$s %2$s FROM %3$s' => [ - null, - [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], - null - ], - 'SELECT %1$s' => [ - [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], - ], - ], - self::JOINS => [ - '%1$s' => [ - [3 => '%1$s JOIN %2$s ON %3$s', 'combinedby' => ' '] - ] - ], - self::WHERE => 'WHERE %1$s', - self::GROUP => [ - 'GROUP BY %1$s' => [ - [1 => '%1$s', 'combinedby' => ', '] - ] - ], - self::HAVING => 'HAVING %1$s', - self::ORDER => [ - 'ORDER BY %1$s' => [ - [1 => '%1$s', 2 => '%1$s %2$s', 'combinedby' => ', '] - ] - ], - self::LIMIT => 'LIMIT %1$s', - self::OFFSET => 'OFFSET %1$s', - 'statementEnd' => '%1$s', - self::COMBINE => '%1$s ( %2$s )', - ]; - - /** - * @var bool - */ - protected $tableReadOnly = false; - - /** - * @var bool - */ - protected $prefixColumnsWithTable = true; - - /** - * @var string|array|TableIdentifier - */ - protected $table = null; - - /** - * @var null|string|Expression - */ - protected $quantifier = null; - - /** - * @var array - */ - protected $columns = [self::SQL_STAR]; - - /** - * @var null|Join - */ - protected $joins = null; - - /** - * @var Where - */ - protected $where = null; - - /** - * @var array - */ - protected $order = []; - - /** - * @var null|array - */ - protected $group = null; - - /** - * @var null|string|array - */ - protected $having = null; - - /** - * @var int|null - */ - protected $limit = null; - - /** - * @var int|null - */ - protected $offset = null; - - /** - * @var array - */ - protected $combine = []; - - /** - * Constructor - * - * @param null|string|array|TableIdentifier $table - */ - public function __construct($table = null) - { - if ($table) { - $this->from($table); - $this->tableReadOnly = true; - } - - $this->where = new Where; - $this->joins = new Join; - $this->having = new Having; - } - - /** - * Create from clause - * - * @param string|array|TableIdentifier $table - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function from($table) - { - if ($this->tableReadOnly) { - throw new Exception\InvalidArgumentException( - 'Since this object was created with a table and/or schema in the constructor, it is read only.' - ); - } - - if (! is_string($table) && ! is_array($table) && ! $table instanceof TableIdentifier) { - throw new Exception\InvalidArgumentException( - '$table must be a string, array, or an instance of TableIdentifier' - ); - } - - if (is_array($table) && (! is_string(key($table)) || count($table) !== 1)) { - throw new Exception\InvalidArgumentException( - 'from() expects $table as an array is a single element associative array' - ); - } - - $this->table = $table; - return $this; - } - - /** - * @param string|Expression $quantifier DISTINCT|ALL - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function quantifier($quantifier) - { - if (! is_string($quantifier) && ! $quantifier instanceof ExpressionInterface) { - throw new Exception\InvalidArgumentException( - 'Quantifier must be one of DISTINCT, ALL, or some platform specific object implementing ' - . 'ExpressionInterface' - ); - } - $this->quantifier = $quantifier; - return $this; - } - - /** - * Specify columns from which to select - * - * Possible valid states: - * - * array(*) - * - * array(value, ...) - * value can be strings or Expression objects - * - * array(string => value, ...) - * key string will be use as alias, - * value can be string or Expression objects - * - * @param array $columns - * @param bool $prefixColumnsWithTable - * @return self Provides a fluent interface - */ - public function columns(array $columns, $prefixColumnsWithTable = true) - { - $this->columns = $columns; - $this->prefixColumnsWithTable = (bool) $prefixColumnsWithTable; - return $this; - } - - /** - * Create join clause - * - * @param string|array|TableIdentifier $name - * @param string|Predicate\Expression $on - * @param string|array $columns - * @param string $type one of the JOIN_* constants - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function join($name, $on, $columns = self::SQL_STAR, $type = self::JOIN_INNER) - { - $this->joins->join($name, $on, $columns, $type); - - return $this; - } - - /** - * Create where clause - * - * @param Where|\Closure|string|array|Predicate\PredicateInterface $predicate - * @param string $combination One of the OP_* constants from Predicate\PredicateSet - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) - { - if ($predicate instanceof Where) { - $this->where = $predicate; - } else { - $this->where->addPredicates($predicate, $combination); - } - return $this; - } - - /** - * @param mixed $group - * @return self Provides a fluent interface - */ - public function group($group) - { - if (is_array($group)) { - foreach ($group as $o) { - $this->group[] = $o; - } - } else { - $this->group[] = $group; - } - return $this; - } - - /** - * Create having clause - * - * @param Where|\Closure|string|array $predicate - * @param string $combination One of the OP_* constants from Predicate\PredicateSet - * @return self Provides a fluent interface - */ - public function having($predicate, $combination = Predicate\PredicateSet::OP_AND) - { - if ($predicate instanceof Having) { - $this->having = $predicate; - } else { - $this->having->addPredicates($predicate, $combination); - } - return $this; - } - - /** - * @param string|array|Expression $order - * @return self Provides a fluent interface - */ - public function order($order) - { - if (is_string($order)) { - if (strpos($order, ',') !== false) { - $order = preg_split('#,\s+#', $order); - } else { - $order = (array) $order; - } - } elseif (! is_array($order)) { - $order = [$order]; - } - foreach ($order as $k => $v) { - if (is_string($k)) { - $this->order[$k] = $v; - } else { - $this->order[] = $v; - } - } - return $this; - } - - /** - * @param int $limit - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function limit($limit) - { - if (! is_numeric($limit)) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects parameter to be numeric, "%s" given', - __METHOD__, - (is_object($limit) ? get_class($limit) : gettype($limit)) - )); - } - - $this->limit = $limit; - return $this; - } - - /** - * @param int $offset - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function offset($offset) - { - if (! is_numeric($offset)) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects parameter to be numeric, "%s" given', - __METHOD__, - (is_object($offset) ? get_class($offset) : gettype($offset)) - )); - } - - $this->offset = $offset; - return $this; - } - - /** - * @param Select $select - * @param string $type - * @param string $modifier - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function combine(Select $select, $type = self::COMBINE_UNION, $modifier = '') - { - if ($this->combine !== []) { - throw new Exception\InvalidArgumentException( - 'This Select object is already combined and cannot be combined with multiple Selects objects' - ); - } - $this->combine = [ - 'select' => $select, - 'type' => $type, - 'modifier' => $modifier - ]; - return $this; - } - - /** - * @param string $part - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function reset($part) - { - switch ($part) { - case self::TABLE: - if ($this->tableReadOnly) { - throw new Exception\InvalidArgumentException( - 'Since this object was created with a table and/or schema in the constructor, it is read only.' - ); - } - $this->table = null; - break; - case self::QUANTIFIER: - $this->quantifier = null; - break; - case self::COLUMNS: - $this->columns = []; - break; - case self::JOINS: - $this->joins = new Join; - break; - case self::WHERE: - $this->where = new Where; - break; - case self::GROUP: - $this->group = null; - break; - case self::HAVING: - $this->having = new Having; - break; - case self::LIMIT: - $this->limit = null; - break; - case self::OFFSET: - $this->offset = null; - break; - case self::ORDER: - $this->order = []; - break; - case self::COMBINE: - $this->combine = []; - break; - } - return $this; - } - - /** - * @param $index - * @param $specification - * @return self Provides a fluent interface - */ - public function setSpecification($index, $specification) - { - if (! method_exists($this, 'process' . $index)) { - throw new Exception\InvalidArgumentException('Not a valid specification name.'); - } - $this->specifications[$index] = $specification; - return $this; - } - - public function getRawState($key = null) - { - $rawState = [ - self::TABLE => $this->table, - self::QUANTIFIER => $this->quantifier, - self::COLUMNS => $this->columns, - self::JOINS => $this->joins, - self::WHERE => $this->where, - self::ORDER => $this->order, - self::GROUP => $this->group, - self::HAVING => $this->having, - self::LIMIT => $this->limit, - self::OFFSET => $this->offset, - self::COMBINE => $this->combine - ]; - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - /** - * Returns whether the table is read only or not. - * - * @return bool - */ - public function isTableReadOnly() - { - return $this->tableReadOnly; - } - - protected function processStatementStart( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->combine !== []) { - return ['(']; - } - } - - protected function processStatementEnd( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->combine !== []) { - return [')']; - } - } - - /** - * Process the select part - * - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @return null|array - */ - protected function processSelect( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - $expr = 1; - - list($table, $fromTable) = $this->resolveTable($this->table, $platform, $driver, $parameterContainer); - // process table columns - $columns = []; - foreach ($this->columns as $columnIndexOrAs => $column) { - if ($column === self::SQL_STAR) { - $columns[] = [$fromTable . self::SQL_STAR]; - continue; - } - - $columnName = $this->resolveColumnValue( - [ - 'column' => $column, - 'fromTable' => $fromTable, - 'isIdentifier' => true, - ], - $platform, - $driver, - $parameterContainer, - (is_string($columnIndexOrAs) ? $columnIndexOrAs : 'column') - ); - // process As portion - if (is_string($columnIndexOrAs)) { - $columnAs = $platform->quoteIdentifier($columnIndexOrAs); - } elseif (stripos($columnName, ' as ') === false) { - $columnAs = (is_string($column)) ? $platform->quoteIdentifier($column) : 'Expression' . $expr++; - } - $columns[] = (isset($columnAs)) ? [$columnName, $columnAs] : [$columnName]; - } - - // process join columns - foreach ($this->joins->getJoins() as $join) { - $joinName = (is_array($join['name'])) ? key($join['name']) : $join['name']; - $joinName = parent::resolveTable($joinName, $platform, $driver, $parameterContainer); - - foreach ($join['columns'] as $jKey => $jColumn) { - $jColumns = []; - $jFromTable = is_scalar($jColumn) - ? $joinName . $platform->getIdentifierSeparator() - : ''; - $jColumns[] = $this->resolveColumnValue( - [ - 'column' => $jColumn, - 'fromTable' => $jFromTable, - 'isIdentifier' => true, - ], - $platform, - $driver, - $parameterContainer, - (is_string($jKey) ? $jKey : 'column') - ); - if (is_string($jKey)) { - $jColumns[] = $platform->quoteIdentifier($jKey); - } elseif ($jColumn !== self::SQL_STAR) { - $jColumns[] = $platform->quoteIdentifier($jColumn); - } - $columns[] = $jColumns; - } - } - - if ($this->quantifier) { - $quantifier = ($this->quantifier instanceof ExpressionInterface) - ? $this->processExpression($this->quantifier, $platform, $driver, $parameterContainer, 'quantifier') - : $this->quantifier; - } - - if (! isset($table)) { - return [$columns]; - } elseif (isset($quantifier)) { - return [$quantifier, $columns, $table]; - } else { - return [$columns, $table]; - } - } - - protected function processJoins( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return $this->processJoin($this->joins, $platform, $driver, $parameterContainer); - } - - protected function processWhere( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->where->count() == 0) { - return; - } - return [ - $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') - ]; - } - - protected function processGroup( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->group === null) { - return; - } - // process table columns - $groups = []; - foreach ($this->group as $column) { - $groups[] = $this->resolveColumnValue( - [ - 'column' => $column, - 'isIdentifier' => true, - ], - $platform, - $driver, - $parameterContainer, - 'group' - ); - } - return [$groups]; - } - - protected function processHaving( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->having->count() == 0) { - return; - } - return [ - $this->processExpression($this->having, $platform, $driver, $parameterContainer, 'having') - ]; - } - - protected function processOrder( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if (empty($this->order)) { - return; - } - $orders = []; - foreach ($this->order as $k => $v) { - if ($v instanceof ExpressionInterface) { - $orders[] = [ - $this->processExpression($v, $platform, $driver, $parameterContainer) - ]; - continue; - } - if (is_int($k)) { - if (strpos($v, ' ') !== false) { - list($k, $v) = preg_split('# #', $v, 2); - } else { - $k = $v; - $v = self::ORDER_ASCENDING; - } - } - if (strcasecmp(trim($v), self::ORDER_DESCENDING) === 0) { - $orders[] = [$platform->quoteIdentifierInFragment($k), self::ORDER_DESCENDING]; - } else { - $orders[] = [$platform->quoteIdentifierInFragment($k), self::ORDER_ASCENDING]; - } - } - return [$orders]; - } - - protected function processLimit( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->limit === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName($paramPrefix . 'limit')]; - } - return [$platform->quoteValue($this->limit)]; - } - - protected function processOffset( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->offset === null) { - return; - } - if ($parameterContainer) { - $paramPrefix = $this->processInfo['paramPrefix']; - $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); - return [$driver->formatParameterName($paramPrefix . 'offset')]; - } - - return [$platform->quoteValue($this->offset)]; - } - - protected function processCombine( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->combine == []) { - return; - } - - $type = $this->combine['type']; - if ($this->combine['modifier']) { - $type .= ' ' . $this->combine['modifier']; - } - - return [ - strtoupper($type), - $this->processSubSelect($this->combine['select'], $platform, $driver, $parameterContainer), - ]; - } - - /** - * Variable overloading - * - * @param string $name - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function __get($name) - { - switch (strtolower($name)) { - case 'where': - return $this->where; - case 'having': - return $this->having; - case 'joins': - return $this->joins; - default: - throw new Exception\InvalidArgumentException('Not a valid magic property for this object'); - } - } - - /** - * __clone - * - * Resets the where object each time the Select is cloned. - * - * @return void - */ - public function __clone() - { - $this->where = clone $this->where; - $this->joins = clone $this->joins; - $this->having = clone $this->having; - } - - /** - * @param string|TableIdentifier|Select $table - * @param PlatformInterface $platform - * @param DriverInterface $driver - * @param ParameterContainer $parameterContainer - * @return string - */ - protected function resolveTable( - $table, - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - $alias = null; - - if (is_array($table)) { - $alias = key($table); - $table = current($table); - } - - $table = parent::resolveTable($table, $platform, $driver, $parameterContainer); - - if ($alias) { - $fromTable = $platform->quoteIdentifier($alias); - $table = $this->renderTable($table, $fromTable); - } else { - $fromTable = $table; - } - - if ($this->prefixColumnsWithTable && $fromTable) { - $fromTable .= $platform->getIdentifierSeparator(); - } else { - $fromTable = ''; - } - - return [ - $table, - $fromTable - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Sql.php b/bundled-libs/zendframework/zend-db/src/Sql/Sql.php deleted file mode 100644 index 2cc14282..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Sql.php +++ /dev/null @@ -1,174 +0,0 @@ -adapter = $adapter; - if ($table) { - $this->setTable($table); - } - $this->sqlPlatform = $sqlPlatform ?: new Platform\Platform($adapter); - } - - /** - * @return null|\Zend\Db\Adapter\AdapterInterface - */ - public function getAdapter() - { - return $this->adapter; - } - - public function hasTable() - { - return ($this->table !== null); - } - - /** - * @param string|array|TableIdentifier $table - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function setTable($table) - { - if (is_string($table) || is_array($table) || $table instanceof TableIdentifier) { - $this->table = $table; - } else { - throw new Exception\InvalidArgumentException( - 'Table must be a string, array or instance of TableIdentifier.' - ); - } - return $this; - } - - public function getTable() - { - return $this->table; - } - - public function getSqlPlatform() - { - return $this->sqlPlatform; - } - - public function select($table = null) - { - if ($this->table !== null && $table !== null) { - throw new Exception\InvalidArgumentException(sprintf( - 'This Sql object is intended to work with only the table "%s" provided at construction time.', - $this->table - )); - } - return new Select(($table) ?: $this->table); - } - - public function insert($table = null) - { - if ($this->table !== null && $table !== null) { - throw new Exception\InvalidArgumentException(sprintf( - 'This Sql object is intended to work with only the table "%s" provided at construction time.', - $this->table - )); - } - return new Insert(($table) ?: $this->table); - } - - public function update($table = null) - { - if ($this->table !== null && $table !== null) { - throw new Exception\InvalidArgumentException(sprintf( - 'This Sql object is intended to work with only the table "%s" provided at construction time.', - $this->table - )); - } - return new Update(($table) ?: $this->table); - } - - public function delete($table = null) - { - if ($this->table !== null && $table !== null) { - throw new Exception\InvalidArgumentException(sprintf( - 'This Sql object is intended to work with only the table "%s" provided at construction time.', - $this->table - )); - } - return new Delete(($table) ?: $this->table); - } - - /** - * @param PreparableSqlInterface $sqlObject - * @param StatementInterface $statement - * @param AdapterInterface $adapter - * - * @return StatementInterface - */ - public function prepareStatementForSqlObject( - PreparableSqlInterface $sqlObject, - StatementInterface $statement = null, - AdapterInterface $adapter = null - ) { - $adapter = $adapter ?: $this->adapter; - $statement = $statement ?: $adapter->getDriver()->createStatement(); - - return $this->sqlPlatform->setSubject($sqlObject)->prepareStatement($adapter, $statement); - } - - /** - * Get sql string using platform or sql object - * - * @param SqlInterface $sqlObject - * @param PlatformInterface|null $platform - * - * @return string - * - * @deprecated Deprecated in 2.4. Use buildSqlString() instead - */ - public function getSqlStringForSqlObject(SqlInterface $sqlObject, PlatformInterface $platform = null) - { - $platform = ($platform) ?: $this->adapter->getPlatform(); - return $this->sqlPlatform->setSubject($sqlObject)->getSqlString($platform); - } - - /** - * @param SqlInterface $sqlObject - * @param AdapterInterface $adapter - * - * @return string - * - * @throws Exception\InvalidArgumentException - */ - public function buildSqlString(SqlInterface $sqlObject, AdapterInterface $adapter = null) - { - return $this - ->sqlPlatform - ->setSubject($sqlObject) - ->getSqlString($adapter ? $adapter->getPlatform() : $this->adapter->getPlatform()); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/SqlInterface.php b/bundled-libs/zendframework/zend-db/src/Sql/SqlInterface.php deleted file mode 100644 index 551a458c..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/SqlInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -table = (string) $table; - - if ('' === $this->table) { - throw new Exception\InvalidArgumentException('$table must be a valid table name, empty string given'); - } - - if (null === $schema) { - $this->schema = null; - } else { - if (! (is_string($schema) || is_callable([$schema, '__toString']))) { - throw new Exception\InvalidArgumentException(sprintf( - '$schema must be a valid schema name, parameter of type %s given', - is_object($schema) ? get_class($schema) : gettype($schema) - )); - } - - $this->schema = (string) $schema; - - if ('' === $this->schema) { - throw new Exception\InvalidArgumentException( - '$schema must be a valid schema name or null, empty string given' - ); - } - } - } - - /** - * @param string $table - * - * @deprecated please use the constructor and build a new {@see TableIdentifier} instead - */ - public function setTable($table) - { - $this->table = $table; - } - - /** - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * @return bool - */ - public function hasSchema() - { - return ($this->schema !== null); - } - - /** - * @param $schema - * - * @deprecated please use the constructor and build a new {@see TableIdentifier} instead - */ - public function setSchema($schema) - { - $this->schema = $schema; - } - - /** - * @return null|string - */ - public function getSchema() - { - return $this->schema; - } - - public function getTableAndSchema() - { - return [$this->table, $this->schema]; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Update.php b/bundled-libs/zendframework/zend-db/src/Sql/Update.php deleted file mode 100644 index 09563cf5..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Update.php +++ /dev/null @@ -1,277 +0,0 @@ - 'UPDATE %1$s', - self::SPECIFICATION_JOIN => [ - '%1$s' => [ - [3 => '%1$s JOIN %2$s ON %3$s', 'combinedby' => ' '] - ] - ], - self::SPECIFICATION_SET => 'SET %1$s', - self::SPECIFICATION_WHERE => 'WHERE %1$s', - ]; - - /** - * @var string|TableIdentifier - */ - protected $table = ''; - - /** - * @var bool - */ - protected $emptyWhereProtection = true; - - /** - * @var PriorityList - */ - protected $set; - - /** - * @var string|Where - */ - protected $where = null; - - /** - * @var null|Join - */ - protected $joins = null; - - /** - * Constructor - * - * @param null|string|TableIdentifier $table - */ - public function __construct($table = null) - { - if ($table) { - $this->table($table); - } - $this->where = new Where(); - $this->joins = new Join(); - $this->set = new PriorityList(); - $this->set->isLIFO(false); - } - - /** - * Specify table for statement - * - * @param string|TableIdentifier $table - * @return self Provides a fluent interface - */ - public function table($table) - { - $this->table = $table; - return $this; - } - - /** - * Set key/value pairs to update - * - * @param array $values Associative array of key values - * @param string $flag One of the VALUES_* constants - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function set(array $values, $flag = self::VALUES_SET) - { - if ($values === null) { - throw new Exception\InvalidArgumentException('set() expects an array of values'); - } - - if ($flag == self::VALUES_SET) { - $this->set->clear(); - } - $priority = is_numeric($flag) ? $flag : 0; - foreach ($values as $k => $v) { - if (! is_string($k)) { - throw new Exception\InvalidArgumentException('set() expects a string for the value key'); - } - $this->set->insert($k, $v, $priority); - } - return $this; - } - - /** - * Create where clause - * - * @param Where|\Closure|string|array $predicate - * @param string $combination One of the OP_* constants from Predicate\PredicateSet - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) - { - if ($predicate instanceof Where) { - $this->where = $predicate; - } else { - $this->where->addPredicates($predicate, $combination); - } - return $this; - } - - /** - * Create join clause - * - * @param string|array $name - * @param string $on - * @param string $type one of the JOIN_* constants - * @return self Provides a fluent interface - * @throws Exception\InvalidArgumentException - */ - public function join($name, $on, $type = Join::JOIN_INNER) - { - $this->joins->join($name, $on, [], $type); - - return $this; - } - - public function getRawState($key = null) - { - $rawState = [ - 'emptyWhereProtection' => $this->emptyWhereProtection, - 'table' => $this->table, - 'set' => $this->set->toArray(), - 'where' => $this->where, - 'joins' => $this->joins - ]; - return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; - } - - protected function processUpdate( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return sprintf( - $this->specifications[static::SPECIFICATION_UPDATE], - $this->resolveTable($this->table, $platform, $driver, $parameterContainer) - ); - } - - protected function processSet( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - $setSql = []; - $i = 0; - foreach ($this->set as $column => $value) { - $prefix = $this->resolveColumnValue( - [ - 'column' => $column, - 'fromTable' => '', - 'isIdentifier' => true, - ], - $platform, - $driver, - $parameterContainer, - 'column' - ); - $prefix .= ' = '; - if (is_scalar($value) && $parameterContainer) { - // use incremental value instead of column name for PDO - // @see https://github.com/zendframework/zend-db/issues/35 - if ($driver instanceof Pdo) { - $column = 'c_' . $i++; - } - $setSql[] = $prefix . $driver->formatParameterName($column); - $parameterContainer->offsetSet($column, $value); - } else { - $setSql[] = $prefix . $this->resolveColumnValue( - $value, - $platform, - $driver, - $parameterContainer - ); - } - } - - return sprintf( - $this->specifications[static::SPECIFICATION_SET], - implode(', ', $setSql) - ); - } - - protected function processWhere( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - if ($this->where->count() == 0) { - return; - } - return sprintf( - $this->specifications[static::SPECIFICATION_WHERE], - $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') - ); - } - - protected function processJoins( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return $this->processJoin($this->joins, $platform, $driver, $parameterContainer); - } - - /** - * Variable overloading - * - * Proxies to "where" only - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (strtolower($name) == 'where') { - return $this->where; - } - } - - /** - * __clone - * - * Resets the where object each time the Update is cloned. - * - * @return void - */ - public function __clone() - { - $this->where = clone $this->where; - $this->set = clone $this->set; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/Sql/Where.php b/bundled-libs/zendframework/zend-db/src/Sql/Where.php deleted file mode 100644 index 68166d52..00000000 --- a/bundled-libs/zendframework/zend-db/src/Sql/Where.php +++ /dev/null @@ -1,14 +0,0 @@ -isInitialized; - } - - /** - * Initialize - * - * @throws Exception\RuntimeException - * @return null - */ - public function initialize() - { - if ($this->isInitialized) { - return; - } - - if (! $this->featureSet instanceof Feature\FeatureSet) { - $this->featureSet = new Feature\FeatureSet; - } - - $this->featureSet->setTableGateway($this); - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_INITIALIZE, []); - - if (! $this->adapter instanceof AdapterInterface) { - throw new Exception\RuntimeException('This table does not have an Adapter setup'); - } - - if (! is_string($this->table) && ! $this->table instanceof TableIdentifier && ! is_array($this->table)) { - throw new Exception\RuntimeException('This table object does not have a valid table set.'); - } - - if (! $this->resultSetPrototype instanceof ResultSetInterface) { - $this->resultSetPrototype = new ResultSet; - } - - if (! $this->sql instanceof Sql) { - $this->sql = new Sql($this->adapter, $this->table); - } - - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_INITIALIZE, []); - - $this->isInitialized = true; - } - - /** - * Get table name - * - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Get adapter - * - * @return AdapterInterface - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * @return array - */ - public function getColumns() - { - return $this->columns; - } - - /** - * @return Feature\FeatureSet - */ - public function getFeatureSet() - { - return $this->featureSet; - } - - /** - * Get select result prototype - * - * @return ResultSetInterface - */ - public function getResultSetPrototype() - { - return $this->resultSetPrototype; - } - - /** - * @return Sql - */ - public function getSql() - { - return $this->sql; - } - - /** - * Select - * - * @param Where|\Closure|string|array $where - * @return ResultSetInterface - */ - public function select($where = null) - { - if (! $this->isInitialized) { - $this->initialize(); - } - - $select = $this->sql->select(); - - if ($where instanceof \Closure) { - $where($select); - } elseif ($where !== null) { - $select->where($where); - } - - return $this->selectWith($select); - } - - /** - * @param Select $select - * @return ResultSetInterface - */ - public function selectWith(Select $select) - { - if (! $this->isInitialized) { - $this->initialize(); - } - return $this->executeSelect($select); - } - - /** - * @param Select $select - * @return ResultSetInterface - * @throws Exception\RuntimeException - */ - protected function executeSelect(Select $select) - { - $selectState = $select->getRawState(); - if ($selectState['table'] != $this->table - && (is_array($selectState['table']) - && end($selectState['table']) != $this->table) - ) { - throw new Exception\RuntimeException( - 'The table name of the provided Select object must match that of the table' - ); - } - - if ($selectState['columns'] == [Select::SQL_STAR] - && $this->columns !== []) { - $select->columns($this->columns); - } - - // apply preSelect features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_SELECT, [$select]); - - // prepare and execute - $statement = $this->sql->prepareStatementForSqlObject($select); - $result = $statement->execute(); - - // build result set - $resultSet = clone $this->resultSetPrototype; - $resultSet->initialize($result); - - // apply postSelect features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_SELECT, [$statement, $result, $resultSet]); - - return $resultSet; - } - - /** - * Insert - * - * @param array $set - * @return int - */ - public function insert($set) - { - if (! $this->isInitialized) { - $this->initialize(); - } - $insert = $this->sql->insert(); - $insert->values($set); - return $this->executeInsert($insert); - } - - /** - * @param Insert $insert - * @return int - */ - public function insertWith(Insert $insert) - { - if (! $this->isInitialized) { - $this->initialize(); - } - return $this->executeInsert($insert); - } - - /** - * @todo add $columns support - * - * @param Insert $insert - * @return int - * @throws Exception\RuntimeException - */ - protected function executeInsert(Insert $insert) - { - $insertState = $insert->getRawState(); - if ($insertState['table'] != $this->table) { - throw new Exception\RuntimeException( - 'The table name of the provided Insert object must match that of the table' - ); - } - - // apply preInsert features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_INSERT, [$insert]); - - // Most RDBMS solutions do not allow using table aliases in INSERTs - // See https://github.com/zendframework/zf2/issues/7311 - $unaliasedTable = false; - if (is_array($insertState['table'])) { - $tableData = array_values($insertState['table']); - $unaliasedTable = array_shift($tableData); - $insert->into($unaliasedTable); - } - - $statement = $this->sql->prepareStatementForSqlObject($insert); - $result = $statement->execute(); - $this->lastInsertValue = $this->adapter->getDriver()->getConnection()->getLastGeneratedValue(); - - // apply postInsert features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_INSERT, [$statement, $result]); - - // Reset original table information in Insert instance, if necessary - if ($unaliasedTable) { - $insert->into($insertState['table']); - } - - return $result->getAffectedRows(); - } - - /** - * Update - * - * @param array $set - * @param string|array|\Closure $where - * @param null|array $joins - * @return int - */ - public function update($set, $where = null, array $joins = null) - { - if (! $this->isInitialized) { - $this->initialize(); - } - $sql = $this->sql; - $update = $sql->update(); - $update->set($set); - if ($where !== null) { - $update->where($where); - } - - if ($joins) { - foreach ($joins as $join) { - $type = isset($join['type']) ? $join['type'] : Join::JOIN_INNER; - $update->join($join['name'], $join['on'], $type); - } - } - - return $this->executeUpdate($update); - } - - /** - * @param \Zend\Db\Sql\Update $update - * @return int - */ - public function updateWith(Update $update) - { - if (! $this->isInitialized) { - $this->initialize(); - } - return $this->executeUpdate($update); - } - - /** - * @todo add $columns support - * - * @param Update $update - * @return int - * @throws Exception\RuntimeException - */ - protected function executeUpdate(Update $update) - { - $updateState = $update->getRawState(); - if ($updateState['table'] != $this->table) { - throw new Exception\RuntimeException( - 'The table name of the provided Update object must match that of the table' - ); - } - - // apply preUpdate features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_UPDATE, [$update]); - - $unaliasedTable = false; - if (is_array($updateState['table'])) { - $tableData = array_values($updateState['table']); - $unaliasedTable = array_shift($tableData); - $update->table($unaliasedTable); - } - - $statement = $this->sql->prepareStatementForSqlObject($update); - $result = $statement->execute(); - - // apply postUpdate features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_UPDATE, [$statement, $result]); - - // Reset original table information in Update instance, if necessary - if ($unaliasedTable) { - $update->table($updateState['table']); - } - - return $result->getAffectedRows(); - } - - /** - * Delete - * - * @param Where|\Closure|string|array $where - * @return int - */ - public function delete($where) - { - if (! $this->isInitialized) { - $this->initialize(); - } - $delete = $this->sql->delete(); - if ($where instanceof \Closure) { - $where($delete); - } else { - $delete->where($where); - } - return $this->executeDelete($delete); - } - - /** - * @param Delete $delete - * @return int - */ - public function deleteWith(Delete $delete) - { - $this->initialize(); - return $this->executeDelete($delete); - } - - /** - * @todo add $columns support - * - * @param Delete $delete - * @return int - * @throws Exception\RuntimeException - */ - protected function executeDelete(Delete $delete) - { - $deleteState = $delete->getRawState(); - if ($deleteState['table'] != $this->table) { - throw new Exception\RuntimeException( - 'The table name of the provided Delete object must match that of the table' - ); - } - - // pre delete update - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_DELETE, [$delete]); - - $statement = $this->sql->prepareStatementForSqlObject($delete); - $result = $statement->execute(); - - // apply postDelete features - $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_DELETE, [$statement, $result]); - - return $result->getAffectedRows(); - } - - /** - * Get last insert value - * - * @return int - */ - public function getLastInsertValue() - { - return $this->lastInsertValue; - } - - /** - * __get - * - * @param string $property - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function __get($property) - { - switch (strtolower($property)) { - case 'lastinsertvalue': - return $this->lastInsertValue; - case 'adapter': - return $this->adapter; - case 'table': - return $this->table; - } - if ($this->featureSet->canCallMagicGet($property)) { - return $this->featureSet->callMagicGet($property); - } - throw new Exception\InvalidArgumentException('Invalid magic property access in ' . __CLASS__ . '::__get()'); - } - - /** - * @param string $property - * @param mixed $value - * @return mixed - * @throws Exception\InvalidArgumentException - */ - public function __set($property, $value) - { - if ($this->featureSet->canCallMagicSet($property)) { - return $this->featureSet->callMagicSet($property, $value); - } - throw new Exception\InvalidArgumentException('Invalid magic property access in ' . __CLASS__ . '::__set()'); - } - - /** - * @param $method - * @param $arguments - * @return mixed - * @throws Exception\InvalidArgumentException - */ - public function __call($method, $arguments) - { - if ($this->featureSet->canCallMagicCall($method)) { - return $this->featureSet->callMagicCall($method, $arguments); - } - throw new Exception\InvalidArgumentException(sprintf( - 'Invalid method (%s) called, caught by %s::__call()', - $method, - __CLASS__ - )); - } - - /** - * __clone - */ - public function __clone() - { - $this->resultSetPrototype = (isset($this->resultSetPrototype)) ? clone $this->resultSetPrototype : null; - $this->sql = clone $this->sql; - if (is_object($this->table)) { - $this->table = clone $this->table; - } elseif (is_array($this->table) - && count($this->table) == 1 - && is_object(reset($this->table)) - ) { - foreach ($this->table as $alias => &$tableObject) { - $tableObject = clone $tableObject; - } - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php deleted file mode 100644 index 7410e597..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -tableGateway = $tableGateway; - } - - public function initialize() - { - throw new Exception\RuntimeException('This method is not intended to be called on this object.'); - } - - public function getMagicMethodSpecifications() - { - return []; - } - - - /* - public function preInitialize(); - public function postInitialize(); - public function preSelect(Select $select); - public function postSelect(StatementInterface $statement, ResultInterface $result, ResultSetInterface $resultSet); - public function preInsert(Insert $insert); - public function postInsert(StatementInterface $statement, ResultInterface $result); - public function preUpdate(Update $update); - public function postUpdate(StatementInterface $statement, ResultInterface $result); - public function preDelete(Delete $delete); - public function postDelete(StatementInterface $statement, ResultInterface $result); - */ -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php deleted file mode 100644 index ea3c70e4..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php +++ /dev/null @@ -1,257 +0,0 @@ -eventManager = ($eventManager instanceof EventManagerInterface) - ? $eventManager - : new EventManager; - - $this->eventManager->addIdentifiers([ - 'Zend\Db\TableGateway\TableGateway', - ]); - - $this->event = ($tableGatewayEvent) ?: new EventFeature\TableGatewayEvent(); - } - - /** - * Retrieve composed event manager instance - * - * @return EventManagerInterface - */ - public function getEventManager() - { - return $this->eventManager; - } - - /** - * Retrieve composed event instance - * - * @return EventFeature\TableGatewayEvent - */ - public function getEvent() - { - return $this->event; - } - - /** - * Initialize feature and trigger "preInitialize" event - * - * Ensures that the composed TableGateway has identifiers based on the - * class name, and that the event target is set to the TableGateway - * instance. It then triggers the "preInitialize" event. - * - * @return void - */ - public function preInitialize() - { - if (get_class($this->tableGateway) != 'Zend\Db\TableGateway\TableGateway') { - $this->eventManager->addIdentifiers([get_class($this->tableGateway)]); - } - - $this->event->setTarget($this->tableGateway); - $this->event->setName(static::EVENT_PRE_INITIALIZE); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "postInitialize" event - * - * @return void - */ - public function postInitialize() - { - $this->event->setName(static::EVENT_POST_INITIALIZE); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "preSelect" event - * - * Triggers the "preSelect" event mapping the following parameters: - * - $select as "select" - * - * @param Select $select - * @return void - */ - public function preSelect(Select $select) - { - $this->event->setName(static::EVENT_PRE_SELECT); - $this->event->setParams(['select' => $select]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "postSelect" event - * - * Triggers the "postSelect" event mapping the following parameters: - * - $statement as "statement" - * - $result as "result" - * - $resultSet as "result_set" - * - * @param StatementInterface $statement - * @param ResultInterface $result - * @param ResultSetInterface $resultSet - * @return void - */ - public function postSelect(StatementInterface $statement, ResultInterface $result, ResultSetInterface $resultSet) - { - $this->event->setName(static::EVENT_POST_SELECT); - $this->event->setParams([ - 'statement' => $statement, - 'result' => $result, - 'result_set' => $resultSet - ]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "preInsert" event - * - * Triggers the "preInsert" event mapping the following parameters: - * - $insert as "insert" - * - * @param Insert $insert - * @return void - */ - public function preInsert(Insert $insert) - { - $this->event->setName(static::EVENT_PRE_INSERT); - $this->event->setParams(['insert' => $insert]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "postInsert" event - * - * Triggers the "postInsert" event mapping the following parameters: - * - $statement as "statement" - * - $result as "result" - * - * @param StatementInterface $statement - * @param ResultInterface $result - * @return void - */ - public function postInsert(StatementInterface $statement, ResultInterface $result) - { - $this->event->setName(static::EVENT_POST_INSERT); - $this->event->setParams([ - 'statement' => $statement, - 'result' => $result, - ]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "preUpdate" event - * - * Triggers the "preUpdate" event mapping the following parameters: - * - $update as "update" - * - * @param Update $update - * @return void - */ - public function preUpdate(Update $update) - { - $this->event->setName(static::EVENT_PRE_UPDATE); - $this->event->setParams(['update' => $update]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "postUpdate" event - * - * Triggers the "postUpdate" event mapping the following parameters: - * - $statement as "statement" - * - $result as "result" - * - * @param StatementInterface $statement - * @param ResultInterface $result - * @return void - */ - public function postUpdate(StatementInterface $statement, ResultInterface $result) - { - $this->event->setName(static::EVENT_POST_UPDATE); - $this->event->setParams([ - 'statement' => $statement, - 'result' => $result, - ]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "preDelete" event - * - * Triggers the "preDelete" event mapping the following parameters: - * - $delete as "delete" - * - * @param Delete $delete - * @return void - */ - public function preDelete(Delete $delete) - { - $this->event->setName(static::EVENT_PRE_DELETE); - $this->event->setParams(['delete' => $delete]); - $this->eventManager->triggerEvent($this->event); - } - - /** - * Trigger the "postDelete" event - * - * Triggers the "postDelete" event mapping the following parameters: - * - $statement as "statement" - * - $result as "result" - * - * @param StatementInterface $statement - * @param ResultInterface $result - * @return void - */ - public function postDelete(StatementInterface $statement, ResultInterface $result) - { - $this->event->setName(static::EVENT_POST_DELETE); - $this->event->setParams([ - 'statement' => $statement, - 'result' => $result, - ]); - $this->eventManager->triggerEvent($this->event); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php deleted file mode 100644 index f014faa4..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php +++ /dev/null @@ -1,139 +0,0 @@ -name; - } - - /** - * Get target/context from which event was triggered - * - * @return null|string|object - */ - public function getTarget() - { - return $this->target; - } - - /** - * Get parameters passed to the event - * - * @return array|\ArrayAccess - */ - public function getParams() - { - return $this->params; - } - - /** - * Get a single parameter by name - * - * @param string $name - * @param mixed $default Default value to return if parameter does not exist - * @return mixed - */ - public function getParam($name, $default = null) - { - return (isset($this->params[$name]) ? $this->params[$name] : $default); - } - - /** - * Set the event name - * - * @param string $name - * @return void - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Set the event target/context - * - * @param null|string|object $target - * @return void - */ - public function setTarget($target) - { - $this->target = $target; - } - - /** - * Set event parameters - * - * @param string $params - * @return void - */ - public function setParams($params) - { - $this->params = $params; - } - - /** - * Set a single parameter by key - * - * @param string $name - * @param mixed $value - * @return void - */ - public function setParam($name, $value) - { - $this->params[$name] = $value; - } - - /** - * Indicate whether or not the parent EventManagerInterface should stop propagating events - * - * @param bool $flag - * @return void - */ - public function stopPropagation($flag = true) - { - return; - } - - /** - * Has this event indicated event propagation should stop? - * - * @return bool - */ - public function propagationIsStopped() - { - return false; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php deleted file mode 100644 index 291ebcd0..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php +++ /dev/null @@ -1,36 +0,0 @@ -addFeatures($features); - } - } - - /** - * @param AbstractTableGateway $tableGateway - * @return self Provides a fluent interface - */ - public function setTableGateway(AbstractTableGateway $tableGateway) - { - $this->tableGateway = $tableGateway; - foreach ($this->features as $feature) { - $feature->setTableGateway($this->tableGateway); - } - return $this; - } - - public function getFeatureByClassName($featureClassName) - { - $feature = false; - foreach ($this->features as $potentialFeature) { - if ($potentialFeature instanceof $featureClassName) { - $feature = $potentialFeature; - break; - } - } - return $feature; - } - - /** - * @param array $features - * @return self Provides a fluent interface - */ - public function addFeatures(array $features) - { - foreach ($features as $feature) { - $this->addFeature($feature); - } - return $this; - } - - /** - * @param AbstractFeature $feature - * @return self Provides a fluent interface - */ - public function addFeature(AbstractFeature $feature) - { - if ($this->tableGateway instanceof TableGatewayInterface) { - $feature->setTableGateway($this->tableGateway); - } - $this->features[] = $feature; - return $this; - } - - public function apply($method, $args) - { - foreach ($this->features as $feature) { - if (method_exists($feature, $method)) { - $return = call_user_func_array([$feature, $method], $args); - if ($return === self::APPLY_HALT) { - break; - } - } - } - } - - /** - * @param string $property - * @return bool - */ - public function canCallMagicGet($property) - { - return false; - } - - /** - * @param string $property - * @return mixed - */ - public function callMagicGet($property) - { - $return = null; - return $return; - } - - /** - * @param string $property - * @return bool - */ - public function canCallMagicSet($property) - { - return false; - } - - /** - * @param $property - * @param $value - * @return mixed - */ - public function callMagicSet($property, $value) - { - $return = null; - return $return; - } - - /** - * Is the method requested available in one of the added features - * @param string $method - * @return bool - */ - public function canCallMagicCall($method) - { - if (! empty($this->features)) { - foreach ($this->features as $feature) { - if (method_exists($feature, $method)) { - return true; - } - } - } - return false; - } - - /** - * Call method of on added feature as though it were a local method - * @param string $method - * @param array $arguments - * @return mixed - */ - public function callMagicCall($method, $arguments) - { - foreach ($this->features as $feature) { - if (method_exists($feature, $method)) { - return $feature->$method($arguments); - } - } - - return; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php deleted file mode 100644 index 7eccdcb2..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php +++ /dev/null @@ -1,67 +0,0 @@ -tableGateway->adapter = self::getStaticAdapter(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php deleted file mode 100644 index 07d36f95..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php +++ /dev/null @@ -1,91 +0,0 @@ -slaveAdapter = $slaveAdapter; - if ($slaveSql) { - $this->slaveSql = $slaveSql; - } - } - - public function getSlaveAdapter() - { - return $this->slaveAdapter; - } - - /** - * @return Sql - */ - public function getSlaveSql() - { - return $this->slaveSql; - } - - /** - * after initialization, retrieve the original adapter as "master" - */ - public function postInitialize() - { - $this->masterSql = $this->tableGateway->sql; - if ($this->slaveSql === null) { - $this->slaveSql = new Sql( - $this->slaveAdapter, - $this->tableGateway->sql->getTable(), - $this->tableGateway->sql->getSqlPlatform() - ); - } - } - - /** - * preSelect() - * Replace adapter with slave temporarily - */ - public function preSelect() - { - $this->tableGateway->sql = $this->slaveSql; - } - - /** - * postSelect() - * Ensure to return to the master adapter - */ - public function postSelect() - { - $this->tableGateway->sql = $this->masterSql; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php deleted file mode 100644 index 9a78f60a..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php +++ /dev/null @@ -1,85 +0,0 @@ -metadata = $metadata; - } - $this->sharedData['metadata'] = [ - 'primaryKey' => null, - 'columns' => [] - ]; - } - - public function postInitialize() - { - if ($this->metadata === null) { - $this->metadata = SourceFactory::createSourceFromAdapter($this->tableGateway->adapter); - } - - // localize variable for brevity - $t = $this->tableGateway; - $m = $this->metadata; - - // get column named - $columns = $m->getColumnNames($t->table); - $t->columns = $columns; - - // set locally - $this->sharedData['metadata']['columns'] = $columns; - - // process primary key only if table is a table; there are no PK constraints on views - if (! ($m->getTable($t->table) instanceof TableObject)) { - return; - } - - $pkc = null; - - foreach ($m->getConstraints($t->table) as $constraint) { - /** @var $constraint \Zend\Db\Metadata\Object\ConstraintObject */ - if ($constraint->getType() == 'PRIMARY KEY') { - $pkc = $constraint; - break; - } - } - - if ($pkc === null) { - throw new Exception\RuntimeException('A primary key for this column could not be found in the metadata.'); - } - - $pkcColumns = $pkc->getColumns(); - if (count($pkcColumns) === 1) { - $primaryKey = $pkcColumns[0]; - } else { - $primaryKey = $pkcColumns; - } - - $this->sharedData['metadata']['primaryKey'] = $primaryKey; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php deleted file mode 100644 index a1482922..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php +++ /dev/null @@ -1,78 +0,0 @@ -constructorArguments = func_get_args(); - } - - public function postInitialize() - { - $args = $this->constructorArguments; - - /** @var $resultSetPrototype ResultSet */ - $resultSetPrototype = $this->tableGateway->resultSetPrototype; - - if (! $this->tableGateway->resultSetPrototype instanceof ResultSet) { - throw new Exception\RuntimeException( - 'This feature ' . __CLASS__ . ' expects the ResultSet to be an instance of Zend\Db\ResultSet\ResultSet' - ); - } - - if (isset($args[0])) { - if (is_string($args[0])) { - $primaryKey = $args[0]; - $rowGatewayPrototype = new RowGateway( - $primaryKey, - $this->tableGateway->table, - $this->tableGateway->adapter - ); - $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); - } elseif ($args[0] instanceof RowGatewayInterface) { - $rowGatewayPrototype = $args[0]; - $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); - } - } else { - // get from metadata feature - $metadata = $this->tableGateway->featureSet->getFeatureByClassName( - 'Zend\Db\TableGateway\Feature\MetadataFeature' - ); - if ($metadata === false || ! isset($metadata->sharedData['metadata'])) { - throw new Exception\RuntimeException( - 'No information was provided to the RowGatewayFeature and/or no MetadataFeature could be consulted ' - . 'to find the primary key necessary for RowGateway object creation.' - ); - } - $primaryKey = $metadata->sharedData['metadata']['primaryKey']; - $rowGatewayPrototype = new RowGateway( - $primaryKey, - $this->tableGateway->table, - $this->tableGateway->adapter - ); - $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php b/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php deleted file mode 100644 index 014171c2..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php +++ /dev/null @@ -1,133 +0,0 @@ -primaryKeyField = $primaryKeyField; - $this->sequenceName = $sequenceName; - } - - /** - * @param Insert $insert - * @return Insert - */ - public function preInsert(Insert $insert) - { - $columns = $insert->getRawState('columns'); - $values = $insert->getRawState('values'); - $key = array_search($this->primaryKeyField, $columns); - if ($key !== false) { - $this->sequenceValue = $values[$key]; - return $insert; - } - - $this->sequenceValue = $this->nextSequenceId(); - if ($this->sequenceValue === null) { - return $insert; - } - - $insert->values([$this->primaryKeyField => $this->sequenceValue], Insert::VALUES_MERGE); - return $insert; - } - - /** - * @param StatementInterface $statement - * @param ResultInterface $result - */ - public function postInsert(StatementInterface $statement, ResultInterface $result) - { - if ($this->sequenceValue !== null) { - $this->tableGateway->lastInsertValue = $this->sequenceValue; - } - } - - /** - * Generate a new value from the specified sequence in the database, and return it. - * @return int - */ - public function nextSequenceId() - { - $platform = $this->tableGateway->adapter->getPlatform(); - $platformName = $platform->getName(); - - switch ($platformName) { - case 'Oracle': - $sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.NEXTVAL as "nextval" FROM dual'; - break; - case 'PostgreSQL': - $sql = 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'; - break; - default: - return; - } - - $statement = $this->tableGateway->adapter->createStatement(); - $statement->prepare($sql); - $result = $statement->execute(); - $sequence = $result->current(); - unset($statement, $result); - return $sequence['nextval']; - } - - /** - * Return the most recent value from the specified sequence in the database. - * @return int - */ - public function lastSequenceId() - { - $platform = $this->tableGateway->adapter->getPlatform(); - $platformName = $platform->getName(); - - switch ($platformName) { - case 'Oracle': - $sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.CURRVAL as "currval" FROM dual'; - break; - case 'PostgreSQL': - $sql = 'SELECT CURRVAL(\'' . $this->sequenceName . '\')'; - break; - default: - return; - } - - $statement = $this->tableGateway->adapter->createStatement(); - $statement->prepare($sql); - $result = $statement->execute(); - $sequence = $result->current(); - unset($statement, $result); - return $sequence['currval']; - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/TableGateway.php b/bundled-libs/zendframework/zend-db/src/TableGateway/TableGateway.php deleted file mode 100644 index 3bfbf213..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/TableGateway.php +++ /dev/null @@ -1,83 +0,0 @@ -table = $table; - - // adapter - $this->adapter = $adapter; - - // process features - if ($features !== null) { - if ($features instanceof Feature\AbstractFeature) { - $features = [$features]; - } - if (is_array($features)) { - $this->featureSet = new Feature\FeatureSet($features); - } elseif ($features instanceof Feature\FeatureSet) { - $this->featureSet = $features; - } else { - throw new Exception\InvalidArgumentException( - 'TableGateway expects $feature to be an instance of an AbstractFeature or a FeatureSet, or an ' - . 'array of AbstractFeatures' - ); - } - } else { - $this->featureSet = new Feature\FeatureSet(); - } - - // result prototype - $this->resultSetPrototype = ($resultSetPrototype) ?: new ResultSet; - - // Sql object (factory for select, insert, update, delete) - $this->sql = ($sql) ?: new Sql($this->adapter, $this->table); - - // check sql object bound to same table - if ($this->sql->getTable() != $this->table) { - throw new Exception\InvalidArgumentException( - 'The table inside the provided Sql object must match the table of this TableGateway' - ); - } - - $this->initialize(); - } -} diff --git a/bundled-libs/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php b/bundled-libs/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php deleted file mode 100644 index 58c7759c..00000000 --- a/bundled-libs/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -variables); - $connection->connect(); - - self::assertTrue($connection->isConnected()); - $connection->disconnect(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TableGatewayTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TableGatewayTest.php deleted file mode 100644 index d46b83bf..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TableGatewayTest.php +++ /dev/null @@ -1,50 +0,0 @@ - 'mysqli', - 'database' => $this->variables['database'], - 'hostname' => $this->variables['hostname'], - 'username' => $this->variables['username'], - 'password' => $this->variables['password'], - 'options' => ['buffer_results' => true] - ]); - $tableGateway = new TableGateway('test', $adapter); - $rowset = $tableGateway->select('id = 0'); - - $this->assertNull($rowset->current()); - } - - /** - * @see https://github.com/zendframework/zend-db/issues/330 - */ - public function testSelectWithEmptyCurrentWithoutBufferResult() - { - $adapter = new Adapter([ - 'driver' => 'mysqli', - 'database' => $this->variables['database'], - 'hostname' => $this->variables['hostname'], - 'username' => $this->variables['username'], - 'password' => $this->variables['password'], - 'options' => ['buffer_results' => false] - ]); - $tableGateway = new TableGateway('test', $adapter); - $rowset = $tableGateway->select('id = 0'); - - $this->assertNull($rowset->current()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TraitSetup.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TraitSetup.php deleted file mode 100644 index a5ee41a5..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Mysqli/TraitSetup.php +++ /dev/null @@ -1,43 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_HOSTNAME', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_PASSWORD', - 'database' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE', - ]; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - if (! getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL')) { - $this->markTestSkipped('Mysqli integration test disabled'); - } - - if (! extension_loaded('mysqli')) { - $this->fail('The phpunit group integration-mysqli was enabled, but the extension is not loaded.'); - } - - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped(sprintf( - 'Missing required variable %s from phpunit.xml for this integration test', - $value - )); - } - $this->variables[$name] = getenv($value); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTest.php deleted file mode 100644 index e6a5c2a6..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Adapter::class, $this->adapter); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTrait.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTrait.php deleted file mode 100644 index 34f950b7..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/AdapterTrait.php +++ /dev/null @@ -1,23 +0,0 @@ -markTestSkipped('pdo_mysql integration tests are not enabled!'); - } - - $this->adapter = new Adapter([ - 'driver' => 'pdo_mysql', - 'database' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE'), - 'hostname' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_HOSTNAME'), - 'username' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_USERNAME'), - 'password' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_PASSWORD') - ]); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php deleted file mode 100644 index 5c7dae39..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php +++ /dev/null @@ -1,57 +0,0 @@ - 1, 'name' => 'foo', 'value' => 'bar']], - ['SELECT * FROM test WHERE id = :id', [':id' => 1], ['id' => 1, 'name' => 'foo', 'value' => 'bar']], - ['SELECT * FROM test WHERE id = :id', ['id' => 1], ['id' => 1, 'name' => 'foo', 'value' => 'bar']] - ]; - } - - /** - * @dataProvider getQueriesWithRowResult - * @covers \Zend\Db\Adapter\Adapter::query - * @covers \Zend\Db\ResultSet\ResultSet::current - */ - public function testQuery($query, $params, $expected) - { - $result = $this->adapter->query($query, $params); - $this->assertInstanceOf(ResultSet::class, $result); - $current = $result->current(); - // test as array value - $this->assertEquals($expected, (array) $current); - // test as object value - foreach ($expected as $key => $value) { - $this->assertEquals($value, $current->$key); - } - } - - /** - * @see https://github.com/zendframework/zend-db/issues/288 - */ - public function testSetSessionTimeZone() - { - $result = $this->adapter->query('SET @@session.time_zone = :tz', [':tz' => 'SYSTEM']); - $this->assertInstanceOf(PdoResult::class, $result); - } - - /** - * @expectedException Zend\Db\Adapter\Exception\RuntimeException - */ - public function testSelectWithNotPermittedBindParamName() - { - $result = $this->adapter->query('SET @@session.time_zone = :tz$', [':tz$' => 'SYSTEM']); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/TableGatewayTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/TableGatewayTest.php deleted file mode 100644 index d9c90ab8..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Driver/Pdo/Mysql/TableGatewayTest.php +++ /dev/null @@ -1,98 +0,0 @@ -adapter); - $this->assertInstanceOf(TableGateway::class, $tableGateway); - } - - /** - * @covers \Zend\Db\TableGateway\TableGateway::select - */ - public function testSelect() - { - $tableGateway = new TableGateway('test', $this->adapter); - $rowset = $tableGateway->select(); - - $this->assertTrue(count($rowset) > 0); - foreach ($rowset as $row) { - $this->assertTrue(isset($row->id)); - $this->assertNotEmpty(isset($row->name)); - $this->assertNotEmpty(isset($row->value)); - } - } - - /** - * @covers \Zend\Db\TableGateway\TableGateway::insert - * @covers \Zend\Db\TableGateway\TableGateway::select - */ - public function testInsert() - { - $tableGateway = new TableGateway('test', $this->adapter); - - $rowset = $tableGateway->select(); - $data = [ - 'name' => 'test_name', - 'value' => 'test_value' - ]; - $affectedRows = $tableGateway->insert($data); - $this->assertEquals(1, $affectedRows); - - $rowSet = $tableGateway->select(['id' => $tableGateway->getLastInsertValue()]); - $row = $rowSet->current(); - - foreach ($data as $key => $value) { - $this->assertEquals($row->$key, $value); - } - } - - /** - * @see https://github.com/zendframework/zend-db/issues/35 - * @see https://github.com/zendframework/zend-db/pull/178 - */ - public function testInsertWithExtendedCharsetFieldName() - { - $tableGateway = new TableGateway('test_charset', $this->adapter); - - $affectedRows = $tableGateway->insert([ - 'field$' => 'test_value1', - 'field_' => 'test_value2' - ]); - $this->assertEquals(1, $affectedRows); - return $tableGateway->getLastInsertValue(); - } - - /** - * @depends testInsertWithExtendedCharsetFieldName - */ - public function testUpdateWithExtendedCharsetFieldName($id) - { - $tableGateway = new TableGateway('test_charset', $this->adapter); - - $data = [ - 'field$' => 'test_value3', - 'field_' => 'test_value4' - ]; - $affectedRows = $tableGateway->update($data, ['id' => $id]); - $this->assertEquals(1, $affectedRows); - - $rowSet = $tableGateway->select(['id' => $id]); - $row = $rowSet->current(); - - foreach ($data as $key => $value) { - $this->assertEquals($row->$key, $value); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/MysqlTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/MysqlTest.php deleted file mode 100644 index bba0e800..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/MysqlTest.php +++ /dev/null @@ -1,75 +0,0 @@ -markTestSkipped(__CLASS__ . ' integration tests are not enabled!'); - } - if (extension_loaded('mysqli')) { - $this->adapters['mysqli'] = new \mysqli( - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_HOSTNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_PASSWORD'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE') - ); - } - if (extension_loaded('pdo')) { - $this->adapters['pdo_mysql'] = new \PDO( - 'mysql:host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_HOSTNAME') . ';dbname=' - . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_PASSWORD') - ); - } - } - - public function testQuoteValueWithMysqli() - { - if (! $this->adapters['mysqli'] instanceof \Mysqli) { - $this->markTestSkipped('MySQL (Mysqli) not configured in unit test configuration file'); - } - $mysql = new Mysql($this->adapters['mysqli']); - $value = $mysql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - - $mysql = new Mysql(new Mysqli\Mysqli(new Mysqli\Connection($this->adapters['mysqli']))); - $value = $mysql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } - - public function testQuoteValueWithPdoMysql() - { - if (! $this->adapters['pdo_mysql'] instanceof \PDO) { - $this->markTestSkipped('MySQL (PDO_Mysql) not configured in unit test configuration file'); - } - $mysql = new Mysql($this->adapters['pdo_mysql']); - $value = $mysql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - - $mysql = new Mysql(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_mysql']))); - $value = $mysql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/PostgresqlTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/PostgresqlTest.php deleted file mode 100644 index e690d561..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/PostgresqlTest.php +++ /dev/null @@ -1,75 +0,0 @@ -markTestSkipped(__CLASS__ . ' integration tests are not enabled!'); - } - if (extension_loaded('pgsql')) { - $this->adapters['pgsql'] = \pg_connect( - 'host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_HOSTNAME') - . ' dbname=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE') - . ' user=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_USERNAME') - . ' password=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_PASSWORD') - ); - } - if (extension_loaded('pdo')) { - $this->adapters['pdo_pgsql'] = new \PDO( - 'pgsql:host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_HOSTNAME') . ';dbname=' - . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_PASSWORD') - ); - } - } - - public function testQuoteValueWithPgsql() - { - if (! is_resource($this->adapters['pgsql'])) { - $this->markTestSkipped('Postgres (pgsql) not configured in unit test configuration file'); - } - $pgsql = new Postgresql($this->adapters['pgsql']); - $value = $pgsql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - - $pgsql = new Postgresql(new Pgsql\Pgsql(new Pgsql\Connection($this->adapters['pgsql']))); - $value = $pgsql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } - - public function testQuoteValueWithPdoPgsql() - { - if (! $this->adapters['pdo_pgsql'] instanceof \PDO) { - $this->markTestSkipped('Postgres (PDO_PGSQL) not configured in unit test configuration file'); - } - $pgsql = new Postgresql($this->adapters['pdo_pgsql']); - $value = $pgsql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - - $pgsql = new Postgresql(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_pgsql']))); - $value = $pgsql->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqlServerTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqlServerTest.php deleted file mode 100644 index 1cd97214..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqlServerTest.php +++ /dev/null @@ -1,61 +0,0 @@ -markTestSkipped(__CLASS__ . ' integration tests are not enabled!'); - } - if (extension_loaded('sqlsrv')) { - $this->adapters['sqlsrv'] = \sqlsrv_connect( - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_HOSTNAME'), - [ - 'UID' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_USERNAME'), - 'PWD' => getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_PASSWORD'), - 'Database' => (getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_DATABASE') ? : null), - ] - ); - if (! $this->adapters['sqlsrv']) { - var_dump(sqlsrv_errors()); - exit; - } - } - if (extension_loaded('pdo')) { - $this->adapters['pdo_sqlsrv'] = new \PDO( - 'sqlsrv:Server=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_HOSTNAME') - . ';Database=' . (getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_DATABASE') ? : null), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_PASSWORD') - ); - } - } - - public function testQuoteValueWithSqlServer() - { - if (! $this->adapters['pdo_sqlsrv']) { - $this->markTestSkipped('SQLServer (pdo_sqlsrv) not configured in unit test configuration file'); - } - $sqlite = new SqlServer($this->adapters['pdo_sqlsrv']); - $value = $sqlite->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqliteTest.php b/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqliteTest.php deleted file mode 100644 index 92b059bc..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Adapter/Platform/SqliteTest.php +++ /dev/null @@ -1,49 +0,0 @@ -markTestSkipped(__CLASS__ . ' integration tests are not enabled!'); - } - if (extension_loaded('pdo')) { - $this->adapters['pdo_sqlite'] = new \PDO( - 'sqlite::memory:' - ); - } - } - - public function testQuoteValueWithPdoSqlite() - { - if (! $this->adapters['pdo_sqlite'] instanceof \PDO) { - $this->markTestSkipped('SQLite (PDO_SQLITE) not configured in unit test configuration file'); - } - $sqlite = new Sqlite($this->adapters['pdo_sqlite']); - $value = $sqlite->quoteValue('value'); - self::assertEquals('\'value\'', $value); - - $sqlite = new Sqlite(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_sqlite']))); - $value = $sqlite->quoteValue('value'); - self::assertEquals('\'value\'', $value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/IntegrationTestListener.php b/bundled-libs/zendframework/zend-db/test/integration/IntegrationTestListener.php deleted file mode 100644 index 9bb4dcaa..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/IntegrationTestListener.php +++ /dev/null @@ -1,62 +0,0 @@ -getName() !== 'integration test') { - return; - } - - if (getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL')) { - $this->fixtureLoader = new \ZendIntegrationTest\Db\Platform\MysqlFixtureLoader(); - } - if (getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL')) { - $this->fixtureLoader = new \ZendIntegrationTest\Db\Platform\PgsqlFixtureLoader(); - } - - if (! isset($this->fixtureLoader)) { - return; - } - printf("\nIntegration test started.\n"); - $this->fixtureLoader->createDatabase(); - } - - public function endTestSuite(TestSuite $suite) - { - if ($suite->getName() !== 'integration test' - || ! isset($this->fixtureLoader) - ) { - return; - } - printf("\nIntegration test ended.\n"); - - $this->fixtureLoader->dropDatabase(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Platform/FixtureLoader.php b/bundled-libs/zendframework/zend-db/test/integration/Platform/FixtureLoader.php deleted file mode 100644 index 98593dd5..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Platform/FixtureLoader.php +++ /dev/null @@ -1,16 +0,0 @@ -pdo = new \PDO( - 'mysql:host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_HOSTNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_PASSWORD') - ); - if (false === $this->pdo->exec(sprintf( - "CREATE DATABASE IF NOT EXISTS %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE') - ))) { - throw new \Exception(sprintf( - "I cannot create the MySQL %s test database: %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE'), - print_r($this->pdo->errorInfo(), true) - )); - } - - $this->pdo->exec('USE ' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE')); - - if (false === $this->pdo->exec(file_get_contents($this->fixtureFile))) { - throw new \Exception(sprintf( - "I cannot create the table for %s database. Check the %s file. %s ", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE'), - $this->fixtureFile, - print_r($this->pdo->errorInfo(), true) - )); - } - } - - public function dropDatabase() - { - $this->pdo->exec(sprintf( - "DROP DATABASE IF EXISTS %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE') - )); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/Platform/PgsqlFixtureLoader.php b/bundled-libs/zendframework/zend-db/test/integration/Platform/PgsqlFixtureLoader.php deleted file mode 100644 index 80e2cb44..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/Platform/PgsqlFixtureLoader.php +++ /dev/null @@ -1,76 +0,0 @@ -pdo = new \PDO( - 'pgsql:host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_HOSTNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_PASSWORD') - ); - - $this->dropDatabase(); - if (false === $this->pdo->exec(sprintf( - "CREATE DATABASE %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE') - ))) { - throw new \Exception(sprintf( - "I cannot create the PostgreSQL %s test database: %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE'), - print_r($this->pdo->errorInfo(), true) - )); - } - - // PostgreSQL cannot switch database on same connection. - unset($this->pdo); - $this->pdo = new \PDO( - 'pgsql:host=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_HOSTNAME') . ';' . - 'dbname=' . getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_MYSQL_DATABASE'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_USERNAME'), - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_PASSWORD') - ); - - if (false === $this->pdo->exec(file_get_contents($this->fixtureFile))) { - throw new \Exception(sprintf( - "I cannot create the table for %s database. Check the %s file. %s ", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE'), - $this->fixtureFile, - print_r($this->pdo->errorInfo(), true) - )); - } - } - - public function dropDatabase() - { - if (! $this->initialRun) { - // Not possible to drop in PostgreSQL. - // Connection is locking the database and trying to close it with unset() - // does not trigger garbage collector on time to actually close it to free the lock. - return; - } - $this->initialRun = false; - - $this->pdo->exec(sprintf( - "DROP DATABASE IF EXISTS %s", - getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_PGSQL_DATABASE') - )); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/mysql.sql b/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/mysql.sql deleted file mode 100644 index a429ff5e..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/mysql.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE IF NOT EXISTS test ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - value VARCHAR(255) NOT NULL, - PRIMARY KEY (id) -); - -INSERT INTO test (name, value) VALUES -('foo', 'bar'), -('bar', 'baz'); - -CREATE TABLE IF NOT EXISTS test_charset ( - id INT NOT NULL AUTO_INCREMENT, - field$ VARCHAR(255) NOT NULL, - field_ VARCHAR(255) NOT NULL, - PRIMARY KEY (id) -); - -INSERT INTO test_charset (field$, field_) VALUES -('foo', 'bar'), -('bar', 'baz'); diff --git a/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/pgsql.sql b/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/pgsql.sql deleted file mode 100644 index f6b10048..00000000 --- a/bundled-libs/zendframework/zend-db/test/integration/TestFixtures/pgsql.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE IF NOT EXISTS test ( - id SERIAL PRIMARY KEY, - name VARCHAR(255) NOT NULL, - value VARCHAR(255) NOT NULL -); - -INSERT INTO test (name, value) VALUES -('foo', 'bar'), -('bar', 'baz'); - -CREATE TABLE IF NOT EXISTS test_charset ( - id SERIAL PRIMARY KEY, - field$ VARCHAR(255) NOT NULL, - field_ VARCHAR(255) NOT NULL -); - -INSERT INTO test_charset (field$, field_) VALUES -('foo', 'bar'), -('bar', 'baz'); diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAbstractServiceFactoryTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAbstractServiceFactoryTest.php deleted file mode 100644 index 978eb1e8..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAbstractServiceFactoryTest.php +++ /dev/null @@ -1,88 +0,0 @@ -serviceManager = new ServiceManager(); - - $config = new Config([ - 'abstract_factories' => ['Zend\Db\Adapter\AdapterAbstractServiceFactory'], - ]); - $config->configureServiceManager($this->serviceManager); - - $this->serviceManager->setService('config', [ - 'db' => [ - 'adapters' => [ - 'Zend\Db\Adapter\Writer' => [ - 'driver' => 'mysqli', - ], - 'Zend\Db\Adapter\Reader' => [ - 'driver' => 'mysqli', - ], - ], - ], - ]); - } - - /** - * @return array - */ - public function providerValidService() - { - return [ - ['Zend\Db\Adapter\Writer'], - ['Zend\Db\Adapter\Reader'], - ]; - } - - /** - * @return array - */ - public function providerInvalidService() - { - return [ - ['Zend\Db\Adapter\Unknown'], - ]; - } - - /** - * @param string $service - * @dataProvider providerValidService - * @requires extension mysqli - */ - public function testValidService($service) - { - $actual = $this->serviceManager->get($service); - self::assertInstanceOf('Zend\Db\Adapter\Adapter', $actual); - } - - /** - * @dataProvider providerInvalidService - * - * @param string $service - */ - public function testInvalidService($service) - { - $this->expectException('\Zend\ServiceManager\Exception\ServiceNotFoundException'); - $this->serviceManager->get($service); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAwareTraitTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAwareTraitTest.php deleted file mode 100644 index ef62f518..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterAwareTraitTest.php +++ /dev/null @@ -1,32 +0,0 @@ -getObjectForTrait('\Zend\Db\Adapter\AdapterAwareTrait'); - - self::assertAttributeEquals(null, 'adapter', $object); - - $driver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $platform = $this->getMockBuilder('Zend\Db\Adapter\Platform\PlatformInterface')->getMock(); - - $adapter = new Adapter($driver, $platform); - - $object->setDbAdapter($adapter); - - self::assertAttributeEquals($adapter, 'adapter', $object); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterServiceFactoryTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterServiceFactoryTest.php deleted file mode 100644 index 5bceeb53..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterServiceFactoryTest.php +++ /dev/null @@ -1,57 +0,0 @@ -markTestSkipped('Adapter factory tests require pdo_sqlite'); - } - - $this->services = $this->prophesize(ServiceLocatorInterface::class); - $this->services->willImplement(ContainerInterface::class); - - $this->factory = new AdapterServiceFactory(); - } - - public function testV2FactoryReturnsAdapter() - { - $this->services->get('config')->willReturn([ - 'db' => [ - 'driver' => 'Pdo_Sqlite', - 'database' => 'sqlite::memory:', - ], - ]); - - $adapter = $this->factory->createService($this->services->reveal()); - self::assertInstanceOf(Adapter::class, $adapter); - } - - public function testV3FactoryReturnsAdapter() - { - $this->services->get('config')->willReturn([ - 'db' => [ - 'driver' => 'Pdo_Sqlite', - 'database' => 'sqlite::memory:', - ], - ]); - - $adapter = $this->factory->__invoke($this->services->reveal(), Adapter::class); - self::assertInstanceOf(Adapter::class, $adapter); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterTest.php deleted file mode 100644 index 21f295d4..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/AdapterTest.php +++ /dev/null @@ -1,316 +0,0 @@ -mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $this->mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $this->mockDriver->expects($this->any())->method('checkEnvironment')->will($this->returnValue(true)); - $this->mockDriver->expects($this->any())->method('getConnection') - ->will($this->returnValue($this->mockConnection)); - $this->mockPlatform = $this->getMockBuilder('Zend\Db\Adapter\Platform\PlatformInterface')->getMock(); - $this->mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $this->mockDriver->expects($this->any())->method('createStatement') - ->will($this->returnValue($this->mockStatement)); - - $this->adapter = new Adapter($this->mockDriver, $this->mockPlatform); - } - - /** - * @testdox unit test: Test setProfiler() will store profiler - * @covers \Zend\Db\Adapter\Adapter::setProfiler - */ - public function testSetProfiler() - { - $ret = $this->adapter->setProfiler(new Profiler\Profiler()); - self::assertSame($this->adapter, $ret); - } - - /** - * @testdox unit test: Test getProfiler() will store profiler - * @covers \Zend\Db\Adapter\Adapter::getProfiler - */ - public function testGetProfiler() - { - $this->adapter->setProfiler($profiler = new Profiler\Profiler()); - self::assertSame($profiler, $this->adapter->getProfiler()); - - $adapter = new Adapter(['driver' => $this->mockDriver, 'profiler' => true], $this->mockPlatform); - self::assertInstanceOf('Zend\Db\Adapter\Profiler\Profiler', $adapter->getProfiler()); - } - - /** - * @testdox unit test: Test createDriverFromParameters() will create proper driver type - * @covers \Zend\Db\Adapter\Adapter::createDriver - */ - public function testCreateDriver() - { - if (extension_loaded('mysqli')) { - $adapter = new Adapter(['driver' => 'mysqli'], $this->mockPlatform); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Mysqli\Mysqli', $adapter->driver); - unset($adapter); - } - - if (extension_loaded('pgsql')) { - $adapter = new Adapter(['driver' => 'pgsql'], $this->mockPlatform); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Pgsql\Pgsql', $adapter->driver); - unset($adapter); - } - - if (extension_loaded('sqlsrv')) { - $adapter = new Adapter(['driver' => 'sqlsrv'], $this->mockPlatform); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv', $adapter->driver); - unset($adapter); - } - - if (extension_loaded('pdo')) { - $adapter = new Adapter(['driver' => 'pdo_sqlite'], $this->mockPlatform); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Pdo\Pdo', $adapter->driver); - unset($adapter); - } - } - - /** - * @testdox unit test: Test createPlatformFromDriver() will create proper platform from driver - * @covers \Zend\Db\Adapter\Adapter::createPlatform - */ - public function testCreatePlatform() - { - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('Mysql')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Mysql', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('SqlServer')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\SqlServer', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('Postgresql')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Postgresql', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('Sqlite')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Sqlite', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('IbmDb2')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\IbmDb2', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('Oracle')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Oracle', $adapter->platform); - unset($adapter, $driver); - - $driver = clone $this->mockDriver; - $driver->expects($this->any())->method('getDatabasePlatformName')->will($this->returnValue('Foo')); - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Sql92', $adapter->platform); - unset($adapter, $driver); - - // ensure platform can created via string, and also that it passed in options to platform object - $driver = [ - 'driver' => 'pdo_sqlite', - 'platform' => 'Oracle', - 'platform_options' => ['quote_identifiers' => false], - ]; - $adapter = new Adapter($driver); - self::assertInstanceOf('Zend\Db\Adapter\Platform\Oracle', $adapter->platform); - self::assertEquals('foo', $adapter->getPlatform()->quoteIdentifier('foo')); - unset($adapter, $driver); - } - - - /** - * @testdox unit test: Test getDriver() will return driver object - * @covers \Zend\Db\Adapter\Adapter::getDriver - */ - public function testGetDriver() - { - self::assertSame($this->mockDriver, $this->adapter->getDriver()); - } - - /** - * @testdox unit test: Test getPlatform() returns platform object - * @covers \Zend\Db\Adapter\Adapter::getPlatform - */ - public function testGetPlatform() - { - self::assertSame($this->mockPlatform, $this->adapter->getPlatform()); - } - - /** - * @testdox unit test: Test getPlatform() returns platform object - * @covers \Zend\Db\Adapter\Adapter::getQueryResultSetPrototype - */ - public function testGetQueryResultSetPrototype() - { - self::assertInstanceOf('Zend\Db\ResultSet\ResultSetInterface', $this->adapter->getQueryResultSetPrototype()); - } - - /** - * @testdox unit test: Test getCurrentSchema() returns current schema from connection object - * @covers \Zend\Db\Adapter\Adapter::getCurrentSchema - */ - public function testGetCurrentSchema() - { - $this->mockConnection->expects($this->any())->method('getCurrentSchema')->will($this->returnValue('FooSchema')); - self::assertEquals('FooSchema', $this->adapter->getCurrentSchema()); - } - - /** - * @testdox unit test: Test query() in prepare mode produces a statement object - * @covers \Zend\Db\Adapter\Adapter::query - */ - public function testQueryWhenPreparedProducesStatement() - { - $s = $this->adapter->query('SELECT foo'); - self::assertSame($this->mockStatement, $s); - } - - /** - * @testdox unit test: Test query() in prepare mode, with array of parameters, produces a result object - * @covers \Zend\Db\Adapter\Adapter::query - */ - public function testQueryWhenPreparedWithParameterArrayProducesResult() - { - $parray = ['bar' => 'foo']; - $sql = 'SELECT foo, :bar'; - $statement = $this->getMockBuilder('\Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->mockDriver->expects($this->any())->method('createStatement') - ->with($sql)->will($this->returnValue($statement)); - $this->mockStatement->expects($this->any())->method('execute')->will($this->returnValue($result)); - - $r = $this->adapter->query($sql, $parray); - self::assertSame($result, $r); - } - - /** - * @testdox unit test: Test query() in prepare mode, with ParameterContainer, produces a result object - * @covers \Zend\Db\Adapter\Adapter::query - */ - public function testQueryWhenPreparedWithParameterContainerProducesResult() - { - $sql = 'SELECT foo'; - $parameterContainer = $this->getMockBuilder('Zend\Db\Adapter\ParameterContainer')->getMock(); - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->mockDriver->expects($this->any())->method('createStatement') - ->with($sql)->will($this->returnValue($this->mockStatement)); - $this->mockStatement->expects($this->any())->method('execute')->will($this->returnValue($result)); - $result->expects($this->any())->method('isQueryResult')->will($this->returnValue(true)); - - $r = $this->adapter->query($sql, $parameterContainer); - self::assertInstanceOf('Zend\Db\ResultSet\ResultSet', $r); - } - - /** - * @testdox unit test: Test query() in execute mode produces a driver result object - * @covers \Zend\Db\Adapter\Adapter::query - */ - public function testQueryWhenExecutedProducesAResult() - { - $sql = 'SELECT foo'; - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->mockConnection->expects($this->any())->method('execute')->with($sql)->will($this->returnValue($result)); - - $r = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - self::assertSame($result, $r); - } - - /** - * @testdox unit test: Test query() in execute mode produces a resultset object - * @covers \Zend\Db\Adapter\Adapter::query - */ - public function testQueryWhenExecutedProducesAResultSetObjectWhenResultIsQuery() - { - $sql = 'SELECT foo'; - - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->mockConnection->expects($this->any())->method('execute')->with($sql)->will($this->returnValue($result)); - $result->expects($this->any())->method('isQueryResult')->will($this->returnValue(true)); - - $r = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); - self::assertInstanceOf('Zend\Db\ResultSet\ResultSet', $r); - - $r = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE, new TemporaryResultSet()); - self::assertInstanceOf('ZendTest\Db\TestAsset\TemporaryResultSet', $r); - } - - /** - * @testdox unit test: Test createStatement() produces a statement object - * @covers \Zend\Db\Adapter\Adapter::createStatement - */ - public function testCreateStatement() - { - self::assertSame($this->mockStatement, $this->adapter->createStatement()); - } - - /** - * @testdox unit test: Test __get() works - * @covers \Zend\Db\Adapter\Adapter::__get - */ - // @codingStandardsIgnoreStart - public function test__get() - { - // @codingStandardsIgnoreEnd - self::assertSame($this->mockDriver, $this->adapter->driver); - self::assertSame($this->mockDriver, $this->adapter->DrivER); - self::assertSame($this->mockPlatform, $this->adapter->PlatForm); - self::assertSame($this->mockPlatform, $this->adapter->platform); - - $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('Invalid magic'); - $this->adapter->foo; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/AbstractIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/AbstractIntegrationTest.php deleted file mode 100644 index 86d9284a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/AbstractIntegrationTest.php +++ /dev/null @@ -1,44 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_DATABASE', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_PASSWORD', - ]; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped( - 'Missing required variable ' . $value . ' from phpunit.xml for this integration test' - ); - } - $this->variables[$name] = getenv($value); - } - - if (! extension_loaded('ibm_db2')) { - $this->fail('The phpunit group integration-ibm_db2 was enabled, but the extension is not loaded.'); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionIntegrationTest.php deleted file mode 100644 index d30508d1..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionIntegrationTest.php +++ /dev/null @@ -1,213 +0,0 @@ -variables); - self::assertInternalType('string', $connection->getCurrentSchema()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::setResource - */ - public function testSetResource() - { - $resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - $connection = new Connection([]); - self::assertSame($connection, $connection->setResource($resource)); - - $connection->disconnect(); - unset($connection); - unset($resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::getResource - */ - public function testGetResource() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertInternalType('resource', $connection->getResource()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::connect - */ - public function testConnect() - { - $connection = new Connection($this->variables); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::isConnected - */ - public function testIsConnected() - { - $connection = new Connection($this->variables); - self::assertFalse($connection->isConnected()); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::disconnect - */ - public function testDisconnect() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertTrue($connection->isConnected()); - $connection->disconnect(); - self::assertFalse($connection->isConnected()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::beginTransaction - */ - public function testBeginTransaction() - { - if (! $this->isTransactionEnabled()) { - $this->markTestIncomplete( - 'I cannot test without the DB2 transactions enabled' - ); - } - $connection = new Connection($this->variables); - $connection->beginTransaction(); - self::assertTrue($connection->inTransaction()); - self::assertEquals(0, db2_autocommit($connection->getResource())); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::commit - */ - public function testCommit() - { - if (! $this->isTransactionEnabled()) { - $this->markTestIncomplete( - 'I cannot test without the DB2 transactions enabled' - ); - } - $connection = new Connection($this->variables); - $connection->beginTransaction(); - - $oldValue = db2_autocommit($connection->getResource()); - $connection->beginTransaction(); - self::assertTrue($connection->inTransaction()); - $connection->commit(); - self::assertFalse($connection->inTransaction()); - self::assertEquals($oldValue, db2_autocommit($connection->getResource())); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::rollback - */ - public function testRollback() - { - if (! $this->isTransactionEnabled()) { - $this->markTestIncomplete( - 'I cannot test without the DB2 transactions enabled' - ); - } - $connection = new Connection($this->variables); - $connection->beginTransaction(); - - $oldValue = db2_autocommit($connection->getResource()); - $connection->beginTransaction(); - self::assertTrue($connection->inTransaction()); - $connection->rollback(); - self::assertFalse($connection->inTransaction()); - self::assertEquals($oldValue, db2_autocommit($connection->getResource())); - } - - /** - * Return true if the transaction is enabled for DB2 - * - * @return bool - */ - protected function isTransactionEnabled() - { - $os = (php_uname('s') == 'OS400'); - if ($os) { - return ini_get('ibm_db2.i5_allow_commit') == 1; - } - - return true; - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::execute - */ - public function testExecute() - { - $ibmdb2 = new IbmDb2($this->variables); - $connection = $ibmdb2->getConnection(); - - $result = $connection->execute('SELECT \'foo\' FROM SYSIBM.SYSDUMMY1'); - self::assertInstanceOf('Zend\Db\Adapter\Driver\IbmDb2\Result', $result); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::getLastGeneratedValue - */ - public function testGetLastGeneratedValue() - { - $this->markTestIncomplete('Need to create a temporary sequence.'); - $connection = new Connection($this->variables); - $connection->getLastGeneratedValue(); - } - - /** - * @group zf3469 - */ - public function testConnectReturnsConnectionWhenResourceSet() - { - $resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - $connection = new Connection([]); - $connection->setResource($resource); - self::assertSame($connection, $connection->connect()); - - $connection->disconnect(); - unset($connection); - unset($resource); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionTest.php deleted file mode 100644 index b305b75d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ConnectionTest.php +++ /dev/null @@ -1,64 +0,0 @@ -connection = new Connection([]); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->connection, $this->connection->setDriver(new IbmDb2([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::setConnectionParameters - */ - public function testSetConnectionParameters() - { - self::assertEquals($this->connection, $this->connection->setConnectionParameters([])); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Connection::getConnectionParameters - */ - public function testGetConnectionParameters() - { - $this->connection->setConnectionParameters(['foo' => 'bar']); - self::assertEquals(['foo' => 'bar'], $this->connection->getConnectionParameters()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2IntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2IntegrationTest.php deleted file mode 100644 index 239be251..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2IntegrationTest.php +++ /dev/null @@ -1,55 +0,0 @@ -checkEnvironment()); - } - - public function testCreateStatement() - { - $driver = new IbmDb2([]); - - $resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - - $stmtResource = db2_prepare($resource, 'SELECT 1 FROM SYSIBM.SYSDUMMY1'); - - $driver->getConnection()->setResource($resource); - - $stmt = $driver->createStatement('SELECT 1 FROM SYSIBM.SYSDUMMY1'); - self::assertInstanceOf('Zend\Db\Adapter\Driver\IbmDb2\Statement', $stmt); - $stmt = $driver->createStatement($stmtResource); - self::assertInstanceOf('Zend\Db\Adapter\Driver\IbmDb2\Statement', $stmt); - $stmt = $driver->createStatement(); - self::assertInstanceOf('Zend\Db\Adapter\Driver\IbmDb2\Statement', $stmt); - - $this->expectException('Zend\Db\Adapter\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('only accepts an SQL string or an ibm_db2 resource'); - $driver->createStatement(new \stdClass); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2Test.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2Test.php deleted file mode 100644 index 3ff53538..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/IbmDb2Test.php +++ /dev/null @@ -1,166 +0,0 @@ -ibmdb2 = new IbmDb2([]); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::registerConnection - */ - public function testRegisterConnection() - { - $mockConnection = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\IbmDb2\Connection', - [[]], - '', - true, - true, - true, - ['setDriver'] - ); - $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->ibmdb2)); - self::assertSame($this->ibmdb2, $this->ibmdb2->registerConnection($mockConnection)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::registerStatementPrototype - */ - public function testRegisterStatementPrototype() - { - $this->ibmdb2 = new IbmDb2([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\IbmDb2\Statement', - [], - '', - true, - true, - true, - ['setDriver'] - ); - $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->ibmdb2)); - self::assertSame($this->ibmdb2, $this->ibmdb2->registerStatementPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::registerResultPrototype - */ - public function testRegisterResultPrototype() - { - $this->ibmdb2 = new IbmDb2([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\IbmDb2\Result', - [], - '', - true, - true, - true, - ['setDriver'] - ); - self::assertSame($this->ibmdb2, $this->ibmdb2->registerResultPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::getDatabasePlatformName - */ - public function testGetDatabasePlatformName() - { - $this->ibmdb2 = new IbmDb2([]); - self::assertEquals('IbmDb2', $this->ibmdb2->getDatabasePlatformName()); - self::assertEquals('IBM DB2', $this->ibmdb2->getDatabasePlatformName(IbmDb2::NAME_FORMAT_NATURAL)); - } - - /** - * @depends testRegisterConnection - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::getConnection - */ - public function testGetConnection($mockConnection) - { - $conn = new \Zend\Db\Adapter\Driver\IbmDb2\Connection([]); - $this->ibmdb2->registerConnection($conn); - self::assertSame($conn, $this->ibmdb2->getConnection()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::createStatement - * @todo Implement testGetPrepareType(). - */ - public function testCreateStatement() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::createResult - * @todo Implement testGetPrepareType(). - */ - public function testCreateResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::getPrepareType - * @todo Implement testGetPrepareType(). - */ - public function testGetPrepareType() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::formatParameterName - * @todo Implement testFormatParameterName(). - */ - public function testFormatParameterName() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\IbmDb2::getLastGeneratedValue - * @todo Implement testGetLastGeneratedValue(). - */ - public function testGetLastGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ResultIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ResultIntegrationTest.php deleted file mode 100644 index affa836a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/ResultIntegrationTest.php +++ /dev/null @@ -1,198 +0,0 @@ -object = new Result; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::initialize - * @todo Implement testInitialize(). - */ - public function testInitialize() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::buffer - * @todo Implement testBuffer(). - */ - public function testBuffer() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::current - * @todo Implement testCurrent(). - */ - public function testCurrent() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::next - * @todo Implement testNext(). - */ - public function testNext() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::key - * @todo Implement testKey(). - */ - public function testKey() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::rewind - * @todo Implement testRewind(). - */ - public function testRewind() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::valid - * @todo Implement testValid(). - */ - public function testValid() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::count - * @todo Implement testCount(). - */ - public function testCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::getFieldCount - * @todo Implement testGetFieldCount(). - */ - public function testGetFieldCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::isQueryResult - * @todo Implement testIsQueryResult(). - */ - public function testIsQueryResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::getAffectedRows - * @todo Implement testGetAffectedRows(). - */ - public function testGetAffectedRows() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Result::getGeneratedValue - * @todo Implement testGetGeneratedValue(). - */ - public function testGetGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementIntegrationTest.php deleted file mode 100644 index 0b9960e9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementIntegrationTest.php +++ /dev/null @@ -1,134 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_DATABASE', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_IBMDB2_PASSWORD', - ]; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped( - 'Missing required variable ' . $value . ' from phpunit.xml for this integration test' - ); - } - $this->variables[$name] = getenv($value); - } - - if (! extension_loaded('ibm_db2')) { - $this->fail('The phpunit group integration-ibm_db2 was enabled, but the extension is not loaded.'); - } - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::initialize - */ - public function testInitialize() - { - $db2Resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - - $statement = new Statement; - self::assertSame($statement, $statement->initialize($db2Resource)); - unset($stmtResource, $db2Resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::getResource - */ - public function testGetResource() - { - $db2Resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - - $statement = new Statement; - $statement->initialize($db2Resource); - $statement->prepare("SELECT 'foo' FROM sysibm.sysdummy1"); - $resource = $statement->getResource(); - self::assertEquals('DB2 Statement', get_resource_type($resource)); - unset($resource, $db2Resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::isPrepared - */ - public function testPrepare() - { - $db2Resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - - $statement = new Statement; - $statement->initialize($db2Resource); - self::assertFalse($statement->isPrepared()); - self::assertSame($statement, $statement->prepare("SELECT 'foo' FROM SYSIBM.SYSDUMMY1")); - self::assertTrue($statement->isPrepared()); - unset($resource, $db2Resource); - } - - /** - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - */ - public function testPrepareThrowsAnExceptionOnFailure() - { - $db2Resource = db2_connect( - $this->variables['database'], - $this->variables['username'], - $this->variables['password'] - ); - $statement = new Statement; - $statement->initialize($db2Resource); - $this->setExpectedException(RuntimeException::class); - $statement->prepare("SELECT"); - } - - /** - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::execute - */ - public function testExecute() - { - $ibmdb2 = new IbmDb2($this->variables); - $statement = $ibmdb2->createStatement("SELECT 'foo' FROM SYSIBM.SYSDUMMY1"); - self::assertSame($statement, $statement->prepare()); - - $result = $statement->execute(); - self::assertInstanceOf('Zend\Db\Adapter\Driver\IbmDb2\Result', $result); - - unset($resource, $ibmdb2); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementTest.php deleted file mode 100644 index 8c600219..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/StatementTest.php +++ /dev/null @@ -1,188 +0,0 @@ -currentErrorReporting = error_reporting(); - $this->statement = new Statement; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - // ensure error_reporting is set back to correct value - error_reporting($this->currentErrorReporting); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->statement, $this->statement->setDriver(new IbmDb2([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::setParameterContainer - */ - public function testSetParameterContainer() - { - self::assertSame($this->statement, $this->statement->setParameterContainer(new ParameterContainer)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::getParameterContainer - * @todo Implement testGetParameterContainer(). - */ - public function testGetParameterContainer() - { - $container = new ParameterContainer; - $this->statement->setParameterContainer($container); - self::assertSame($container, $this->statement->getParameterContainer()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::setSql - * @todo Implement testSetSql(). - */ - public function testSetSql() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::getSql - * @todo Implement testGetSql(). - */ - public function testGetSql() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::isPrepared - */ - public function testPrepare() - { - $sql = "SELECT 'foo' FROM SYSIBM.SYSDUMMY1"; - $this->statement->prepare($sql); - $this->assertTrue($this->statement->isPrepared()); - } - - /** - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::isPrepared - */ - public function testPreparingTwiceErrors() - { - $sql = "SELECT 'foo' FROM SYSIBM.SYSDUMMY1"; - $this->statement->prepare($sql); - $this->assertTrue($this->statement->isPrepared()); - - $this->expectException( - RuntimeException::class, - 'This statement has been prepared already' - ); - $this->statement->prepare($sql); - } - - /** - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::setSql - */ - public function testPrepareThrowsRuntimeExceptionOnInvalidSql() - { - $sql = "INVALID SQL"; - $this->statement->setSql($sql); - - $this->expectException( - RuntimeException::class, - 'SQL is invalid. Error message' - ); - $this->statement->prepare(); - } - - /** - * If error_reporting() is turned off, then the error handler will not - * be called, but a RuntimeException will still be generated as the - * resource is false - * - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::prepare - * @covers Zend\Db\Adapter\Driver\IbmDb2\Statement::setSql - */ - public function testPrepareThrowsRuntimeExceptionOnInvalidSqlWithErrorReportingDisabled() - { - error_reporting(0); - $sql = "INVALID SQL"; - $this->statement->setSql($sql); - - $this->expectException( - RuntimeException::class, - 'Error message' - ); - $this->statement->prepare(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\IbmDb2\Statement::execute - * @todo Implement testExecute(). - */ - public function testExecute() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/TestAsset/Db2Functions.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/TestAsset/Db2Functions.php deleted file mode 100644 index 7ac4cace..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/IbmDb2/TestAsset/Db2Functions.php +++ /dev/null @@ -1,57 +0,0 @@ -markTestSkipped('Mysqli test disabled'); - } - $this->connection = new Connection([]); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Mysqli\Connection::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->connection, $this->connection->setDriver(new Mysqli([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Mysqli\Connection::setConnectionParameters - */ - public function testSetConnectionParameters() - { - self::assertEquals($this->connection, $this->connection->setConnectionParameters([])); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Mysqli\Connection::getConnectionParameters - */ - public function testGetConnectionParameters() - { - $this->connection->setConnectionParameters(['foo' => 'bar']); - self::assertEquals(['foo' => 'bar'], $this->connection->getConnectionParameters()); - } - - public function testConnectionFails() - { - $connection = new Connection([]); - - $this->expectException('\Zend\Db\Adapter\Exception\RuntimeException'); - $this->expectExceptionMessage('Connection error'); - $connection->connect(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/AbstractIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/AbstractIntegrationTest.php deleted file mode 100644 index ca818cd8..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/AbstractIntegrationTest.php +++ /dev/null @@ -1,41 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_HOSTNAME', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_PASSWORD', - ]; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped( - 'Missing required variable ' . $value . ' from phpunit.xml for this integration test' - ); - } - $this->variables[$name] = getenv($value); - } - - if (! extension_loaded('oci8')) { - $this->fail('The phpunit group integration-oci8 was enabled, but the extension is not loaded.'); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionIntegrationTest.php deleted file mode 100644 index 8b3d7081..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionIntegrationTest.php +++ /dev/null @@ -1,180 +0,0 @@ -variables); - self::assertInternalType('string', $connection->getCurrentSchema()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::setResource - */ - public function testSetResource() - { - $this->markTestIncomplete('edit this'); - $resource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $connection = new Connection([]); - self::assertSame($connection, $connection->setResource($resource)); - - $connection->disconnect(); - unset($connection); - unset($resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::getResource - */ - public function testGetResource() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertInternalType('resource', $connection->getResource()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::connect - */ - public function testConnect() - { - $connection = new Connection($this->variables); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::isConnected - */ - public function testIsConnected() - { - $connection = new Connection($this->variables); - self::assertFalse($connection->isConnected()); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::disconnect - */ - public function testDisconnect() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertTrue($connection->isConnected()); - $connection->disconnect(); - self::assertFalse($connection->isConnected()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::beginTransaction - * @todo Implement testBeginTransaction(). - */ - public function testBeginTransaction() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::commit - * @todo Implement testCommit(). - */ - public function testCommit() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::rollback - * @todo Implement testRollback(). - */ - public function testRollback() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::execute - */ - public function testExecute() - { - $oci8 = new Oci8($this->variables); - $connection = $oci8->getConnection(); - - $result = $connection->execute('SELECT \'foo\' FROM DUAL'); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Oci8\Result', $result); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::getLastGeneratedValue - */ - public function testGetLastGeneratedValue() - { - $this->markTestIncomplete('Need to create a temporary sequence.'); - $connection = new Connection($this->variables); - $connection->getLastGeneratedValue(); - } - - /** - * @group zf3469 - */ - public function testConnectReturnsConnectionWhenResourceSet() - { - $this->markTestIncomplete('edit this'); - $resource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $connection = new Connection([]); - $connection->setResource($resource); - self::assertSame($connection, $connection->connect()); - - $connection->disconnect(); - unset($connection); - unset($resource); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionTest.php deleted file mode 100644 index 426f3c1f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ConnectionTest.php +++ /dev/null @@ -1,64 +0,0 @@ -connection = new Connection([]); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->connection, $this->connection->setDriver(new Oci8([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::setConnectionParameters - */ - public function testSetConnectionParameters() - { - self::assertEquals($this->connection, $this->connection->setConnectionParameters([])); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Connection::getConnectionParameters - */ - public function testGetConnectionParameters() - { - $this->connection->setConnectionParameters(['foo' => 'bar']); - self::assertEquals(['foo' => 'bar'], $this->connection->getConnectionParameters()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Feature/RowCounterTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Feature/RowCounterTest.php deleted file mode 100644 index 8a2602ff..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Feature/RowCounterTest.php +++ /dev/null @@ -1,113 +0,0 @@ -rowCounter = new RowCounter(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Feature\RowCounter::getName - */ - public function testGetName() - { - self::assertEquals('RowCounter', $this->rowCounter->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Feature\RowCounter::getCountForStatement - */ - public function testGetCountForStatement() - { - $statement = $this->getMockStatement('SELECT XXX', 5); - $statement->expects($this->once()) - ->method('prepare') - ->with($this->equalTo('SELECT COUNT(*) as "count" FROM (SELECT XXX)')); - $count = $this->rowCounter->getCountForStatement($statement); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Feature\RowCounter::getCountForSql - */ - public function testGetCountForSql() - { - $this->rowCounter->setDriver($this->getMockDriver(5)); - $count = $this->rowCounter->getCountForSql('SELECT XXX'); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Feature\RowCounter::getRowCountClosure - */ - public function testGetRowCountClosure() - { - $stmt = $this->getMockStatement('SELECT XXX', 5); - /** @var \Closure $closure */ - $closure = $this->rowCounter->getRowCountClosure($stmt); - self::assertInstanceOf('Closure', $closure); - self::assertEquals(5, $closure()); - } - - protected function getMockStatement($sql, $returnValue) - { - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\Oci8\Statement') - ->setMethods(['prepare', 'execute']) - ->disableOriginalConstructor() - ->getMock(); - - // mock the result - $result = $this->getMockBuilder('stdClass') - ->setMethods(['current']) - ->getMock(); - $result->expects($this->once()) - ->method('current') - ->will($this->returnValue(['count' => $returnValue])); - $statement->setSql($sql); - $statement->expects($this->once()) - ->method('execute') - ->will($this->returnValue($result)); - return $statement; - } - - protected function getMockDriver($returnValue) - { - $oci8Statement = $this->getMockBuilder('stdClass') - ->setMethods(['current']) - ->disableOriginalConstructor() - ->getMock(); // stdClass can be used here - $oci8Statement->expects($this->once()) - ->method('current') - ->will($this->returnValue(['count' => $returnValue])); - $connection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $connection->expects($this->once()) - ->method('execute') - ->will($this->returnValue($oci8Statement)); - $driver = $this->getMockBuilder('Zend\Db\Adapter\Driver\Oci8\Oci8') - ->setMethods(['getConnection']) - ->disableOriginalConstructor() - ->getMock(); - $driver->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($connection)); - return $driver; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8IntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8IntegrationTest.php deleted file mode 100644 index 3d816fab..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8IntegrationTest.php +++ /dev/null @@ -1,50 +0,0 @@ -checkEnvironment()); - } - - public function testCreateStatement() - { - $driver = new Oci8([]); - $resource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $driver->getConnection()->setResource($resource); - - $stmt = $driver->createStatement('SELECT * FROM DUAL'); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Oci8\Statement', $stmt); - $stmt = $driver->createStatement(); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Oci8\Statement', $stmt); - - $this->expectException('Zend\Db\Adapter\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('only accepts an SQL string or an oci8 resource'); - $driver->createStatement(new \stdClass); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8Test.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8Test.php deleted file mode 100644 index c85c5623..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/Oci8Test.php +++ /dev/null @@ -1,166 +0,0 @@ -oci8 = new Oci8([]); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::registerConnection - */ - public function testRegisterConnection() - { - $mockConnection = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Oci8\Connection', - [[]], - '', - true, - true, - true, - ['setDriver'] - ); - $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->oci8)); - self::assertSame($this->oci8, $this->oci8->registerConnection($mockConnection)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::registerStatementPrototype - */ - public function testRegisterStatementPrototype() - { - $this->oci8 = new Oci8([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Oci8\Statement', - [], - '', - true, - true, - true, - ['setDriver'] - ); - $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->oci8)); - self::assertSame($this->oci8, $this->oci8->registerStatementPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::registerResultPrototype - */ - public function testRegisterResultPrototype() - { - $this->oci8 = new Oci8([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Oci8\Result', - [], - '', - true, - true, - true, - ['setDriver'] - ); - self::assertSame($this->oci8, $this->oci8->registerResultPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::getDatabasePlatformName - */ - public function testGetDatabasePlatformName() - { - $this->oci8 = new Oci8([]); - self::assertEquals('Oracle', $this->oci8->getDatabasePlatformName()); - self::assertEquals('Oracle', $this->oci8->getDatabasePlatformName(Oci8::NAME_FORMAT_NATURAL)); - } - - /** - * @depends testRegisterConnection - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::getConnection - */ - public function testGetConnection($mockConnection) - { - $conn = new \Zend\Db\Adapter\Driver\Oci8\Connection([]); - $this->oci8->registerConnection($conn); - self::assertSame($conn, $this->oci8->getConnection()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::createStatement - * @todo Implement testGetPrepareType(). - */ - public function testCreateStatement() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::createResult - * @todo Implement testGetPrepareType(). - */ - public function testCreateResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::getPrepareType - * @todo Implement testGetPrepareType(). - */ - public function testGetPrepareType() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::formatParameterName - * @todo Implement testFormatParameterName(). - */ - public function testFormatParameterName() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Oci8::getLastGeneratedValue - * @todo Implement testGetLastGeneratedValue(). - */ - public function testGetLastGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultIntegrationTest.php deleted file mode 100644 index 69f7ca98..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultIntegrationTest.php +++ /dev/null @@ -1,198 +0,0 @@ -object = new Result; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::initialize - * @todo Implement testInitialize(). - */ - public function testInitialize() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::buffer - * @todo Implement testBuffer(). - */ - public function testBuffer() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::current - * @todo Implement testCurrent(). - */ - public function testCurrent() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::next - * @todo Implement testNext(). - */ - public function testNext() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::key - * @todo Implement testKey(). - */ - public function testKey() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::rewind - * @todo Implement testRewind(). - */ - public function testRewind() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::valid - * @todo Implement testValid(). - */ - public function testValid() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::count - * @todo Implement testCount(). - */ - public function testCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::getFieldCount - * @todo Implement testGetFieldCount(). - */ - public function testGetFieldCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::isQueryResult - * @todo Implement testIsQueryResult(). - */ - public function testIsQueryResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::getAffectedRows - * @todo Implement testGetAffectedRows(). - */ - public function testGetAffectedRows() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::getGeneratedValue - * @todo Implement testGetGeneratedValue(). - */ - public function testGetGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultTest.php deleted file mode 100644 index 4e3a0cd9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/ResultTest.php +++ /dev/null @@ -1,90 +0,0 @@ -getResource()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::buffer - */ - public function testBuffer() - { - $result = new Result(); - self::assertNull($result->buffer()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::isBuffered - */ - public function testIsBuffered() - { - $result = new Result(); - self::assertFalse($result->isBuffered()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::getGeneratedValue - */ - public function testGetGeneratedValue() - { - $result = new Result(); - self::assertNull($result->getGeneratedValue()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::key - */ - public function testKey() - { - $result = new Result(); - self::assertEquals(0, $result->key()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::next - */ - public function testNext() - { - $mockResult = $this->getMockBuilder('Zend\Db\Adapter\Driver\Oci8\Result') - ->setMethods(['loadData']) - ->getMock(); - $mockResult->expects($this->any()) - ->method('loadData') - ->will($this->returnValue(true)); - self::assertTrue($mockResult->next()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Result::rewind - */ - public function testRewind() - { - $result = new Result(); - self::assertNull($result->rewind()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementIntegrationTest.php deleted file mode 100644 index e91b827d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementIntegrationTest.php +++ /dev/null @@ -1,117 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_HOSTNAME', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_OCI8_PASSWORD', - ]; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped( - 'Missing required variable ' . $value . ' from phpunit.xml for this integration test' - ); - } - $this->variables[$name] = getenv($value); - } - - if (! extension_loaded('oci8')) { - $this->fail('The phpunit group integration-oracle was enabled, but the extension is not loaded.'); - } - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::initialize - */ - public function testInitialize() - { - $ociResource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $statement = new Statement; - self::assertSame($statement, $statement->initialize($ociResource)); - unset($stmtResource, $ociResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::getResource - */ - public function testGetResource() - { - $ociResource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $statement = new Statement; - $statement->initialize($ociResource); - $statement->prepare('SELECT * FROM DUAL'); - $resource = $statement->getResource(); - self::assertEquals('oci8 statement', get_resource_type($resource)); - unset($resource, $ociResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::prepare - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::isPrepared - */ - public function testPrepare() - { - $ociResource = oci_connect( - $this->variables['username'], - $this->variables['password'], - $this->variables['hostname'] - ); - - $statement = new Statement; - $statement->initialize($ociResource); - self::assertFalse($statement->isPrepared()); - self::assertSame($statement, $statement->prepare('SELECT * FROM DUAL')); - self::assertTrue($statement->isPrepared()); - unset($resource, $ociResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::execute - */ - public function testExecute() - { - $oci8 = new Oci8($this->variables); - $statement = $oci8->createStatement('SELECT * FROM DUAL'); - self::assertSame($statement, $statement->prepare()); - - $result = $statement->execute(); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Oci8\Result', $result); - - unset($resource, $oci8); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementTest.php deleted file mode 100644 index b563a2c9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Oci8/StatementTest.php +++ /dev/null @@ -1,161 +0,0 @@ -statement = new Statement; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->statement, $this->statement->setDriver(new Oci8([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::setProfiler - */ - public function testSetProfiler() - { - self::assertEquals($this->statement, $this->statement->setProfiler(new Profiler())); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::getProfiler - */ - public function testGetProfiler() - { - $profiler = new Profiler(); - $this->statement->setProfiler($profiler); - self::assertEquals($profiler, $this->statement->getProfiler()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::initialize - */ - public function testInitialize() - { - $oci8 = new Oci8([]); - self::assertEquals($this->statement, $this->statement->initialize($oci8)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::setSql - */ - public function testSetSql() - { - self::assertEquals($this->statement, $this->statement->setSql('select * from table')); - self::assertEquals('select * from table', $this->statement->getSql()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::setParameterContainer - */ - public function testSetParameterContainer() - { - self::assertSame($this->statement, $this->statement->setParameterContainer(new ParameterContainer)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::getParameterContainer - * @todo Implement testGetParameterContainer(). - */ - public function testGetParameterContainer() - { - $container = new ParameterContainer; - $this->statement->setParameterContainer($container); - self::assertSame($container, $this->statement->getParameterContainer()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::getSql - * @todo Implement testGetSql(). - */ - public function testGetSql() - { - self::assertEquals($this->statement, $this->statement->setSql('select * from table')); - self::assertEquals('select * from table', $this->statement->getSql()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::prepare - * @todo Implement testPrepare(). - */ - public function testPrepare() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::isPrepared - */ - public function testIsPrepared() - { - self::assertFalse($this->statement->isPrepared()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Oci8\Statement::execute - * @todo Implement testExecute(). - */ - public function testExecute() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionIntegrationTest.php deleted file mode 100644 index 80547ad2..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionIntegrationTest.php +++ /dev/null @@ -1,183 +0,0 @@ - 'sqlite', 'database' => ':memory:']; - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::getCurrentSchema - */ - public function testGetCurrentSchema() - { - $connection = new Connection($this->variables); - self::assertInternalType('string', $connection->getCurrentSchema()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::setResource - */ - public function testSetResource() - { - $resource = new TestAsset\SqliteMemoryPdo(); - $connection = new Connection([]); - self::assertSame($connection, $connection->setResource($resource)); - - $connection->disconnect(); - unset($connection); - unset($resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::getResource - */ - public function testGetResource() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertInstanceOf('PDO', $connection->getResource()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::connect - */ - public function testConnect() - { - $connection = new Connection($this->variables); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::isConnected - */ - public function testIsConnected() - { - $connection = new Connection($this->variables); - self::assertFalse($connection->isConnected()); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::disconnect - */ - public function testDisconnect() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertTrue($connection->isConnected()); - $connection->disconnect(); - self::assertFalse($connection->isConnected()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::beginTransaction - * @todo Implement testBeginTransaction(). - */ - public function testBeginTransaction() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit - * @todo Implement testCommit(). - */ - public function testCommit() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback - * @todo Implement testRollback(). - */ - public function testRollback() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::execute - */ - public function testExecute() - { - $sqlsrv = new Pdo($this->variables); - $connection = $sqlsrv->getConnection(); - - $result = $connection->execute('SELECT \'foo\''); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Pdo\Result', $result); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::prepare - */ - public function testPrepare() - { - $sqlsrv = new Pdo($this->variables); - $connection = $sqlsrv->getConnection(); - - $statement = $connection->prepare('SELECT \'foo\''); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Pdo\Statement', $statement); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::getLastGeneratedValue - */ - public function testGetLastGeneratedValue() - { - $this->markTestIncomplete('Need to create a temporary sequence.'); - $connection = new Connection($this->variables); - $connection->getLastGeneratedValue(); - } - - /** - * @group zf3469 - */ - public function testConnectReturnsConnectionWhenResourceSet() - { - $resource = new TestAsset\SqliteMemoryPdo(); - $connection = new Connection([]); - $connection->setResource($resource); - self::assertSame($connection, $connection->connect()); - - $connection->disconnect(); - unset($connection); - unset($resource); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTest.php deleted file mode 100644 index 9987c513..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTest.php +++ /dev/null @@ -1,123 +0,0 @@ -connection = new Connection(); - } - - /** - * Test getResource method tries to connect to the database, it should never return null - * - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::getResource - */ - public function testResource() - { - $this->expectException('Zend\Db\Adapter\Exception\InvalidConnectionParametersException'); - $this->connection->getResource(); - } - - /** - * Test getConnectedDsn returns a DSN string if it has been set - * - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::getDsn - */ - public function testGetDsn() - { - $dsn = "sqlite::memory:"; - $this->connection->setConnectionParameters(['dsn' => $dsn]); - try { - $this->connection->connect(); - } catch (\Exception $e) { - } - $responseString = $this->connection->getDsn(); - - self::assertEquals($dsn, $responseString); - } - - /** - * @group 2622 - */ - public function testArrayOfConnectionParametersCreatesCorrectDsn() - { - $this->connection->setConnectionParameters([ - 'driver' => 'pdo_mysql', - 'charset' => 'utf8', - 'dbname' => 'foo', - 'port' => '3306', - 'unix_socket' => '/var/run/mysqld/mysqld.sock', - ]); - try { - $this->connection->connect(); - } catch (\Exception $e) { - } - $responseString = $this->connection->getDsn(); - - self::assertStringStartsWith('mysql:', $responseString); - self::assertContains('charset=utf8', $responseString); - self::assertContains('dbname=foo', $responseString); - self::assertContains('port=3306', $responseString); - self::assertContains('unix_socket=/var/run/mysqld/mysqld.sock', $responseString); - } - - public function testHostnameAndUnixSocketThrowsInvalidConnectionParametersException() - { - $this->expectException('Zend\Db\Adapter\Exception\InvalidConnectionParametersException'); - $this->expectExceptionMessage( - 'Ambiguous connection parameters, both hostname and unix_socket parameters were set' - ); - - $this->connection->setConnectionParameters([ - 'driver' => 'pdo_mysql', - 'host' => '127.0.0.1', - 'dbname' => 'foo', - 'port' => '3306', - 'unix_socket' => '/var/run/mysqld/mysqld.sock', - ]); - $this->connection->connect(); - } - - public function testDblibArrayOfConnectionParametersCreatesCorrectDsn() - { - $this->connection->setConnectionParameters([ - 'driver' => 'pdo_dblib', - 'charset' => 'UTF-8', - 'dbname' => 'foo', - 'port' => '1433', - 'version' => '7.3', - ]); - try { - $this->connection->connect(); - } catch (\Exception $e) { - } - $responseString = $this->connection->getDsn(); - - $this->assertStringStartsWith('dblib:', $responseString); - $this->assertContains('charset=UTF-8', $responseString); - $this->assertContains('dbname=foo', $responseString); - $this->assertContains('port=1433', $responseString); - $this->assertContains('version=7.3', $responseString); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTransactionsTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTransactionsTest.php deleted file mode 100644 index 1864cb67..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ConnectionTransactionsTest.php +++ /dev/null @@ -1,201 +0,0 @@ -wrapper = new ConnectionWrapper(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::beginTransaction() - */ - public function testBeginTransactionReturnsInstanceOfConnection() - { - self::assertInstanceOf('\Zend\Db\Adapter\Driver\Pdo\Connection', $this->wrapper->beginTransaction()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::beginTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - */ - public function testBeginTransactionSetsInTransactionAtTrue() - { - $this->wrapper->beginTransaction(); - self::assertTrue($this->wrapper->inTransaction()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit() - */ - public function testCommitReturnsInstanceOfConnection() - { - $this->wrapper->beginTransaction(); - self::assertInstanceOf('\Zend\Db\Adapter\Driver\Pdo\Connection', $this->wrapper->commit()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - */ - public function testCommitSetsInTransactionAtFalse() - { - $this->wrapper->beginTransaction(); - $this->wrapper->commit(); - self::assertFalse($this->wrapper->inTransaction()); - } - - /** - * Standalone commit after a SET autocommit=0; - * - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit() - */ - public function testCommitWithoutBeginReturnsInstanceOfConnection() - { - self::assertInstanceOf('\Zend\Db\Adapter\Driver\Pdo\Connection', $this->wrapper->commit()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::beginTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit() - */ - public function testNestedTransactionsCommit() - { - $nested = 0; - - self::assertFalse($this->wrapper->inTransaction()); - - // 1st transaction - $this->wrapper->beginTransaction(); - self::assertTrue($this->wrapper->inTransaction()); - self::assertSame(++ $nested, $this->wrapper->getNestedTransactionsCount()); - - // 2nd transaction - $this->wrapper->beginTransaction(); - self::assertTrue($this->wrapper->inTransaction()); - self::assertSame(++ $nested, $this->wrapper->getNestedTransactionsCount()); - - // 1st commit - $this->wrapper->commit(); - self::assertTrue($this->wrapper->inTransaction()); - self::assertSame(-- $nested, $this->wrapper->getNestedTransactionsCount()); - - // 2nd commit - $this->wrapper->commit(); - self::assertFalse($this->wrapper->inTransaction()); - self::assertSame(-- $nested, $this->wrapper->getNestedTransactionsCount()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::beginTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback() - */ - public function testNestedTransactionsRollback() - { - $nested = 0; - - self::assertFalse($this->wrapper->inTransaction()); - - // 1st transaction - $this->wrapper->beginTransaction(); - self::assertTrue($this->wrapper->inTransaction()); - self::assertSame(++ $nested, $this->wrapper->getNestedTransactionsCount()); - - // 2nd transaction - $this->wrapper->beginTransaction(); - self::assertTrue($this->wrapper->inTransaction()); - self::assertSame(++ $nested, $this->wrapper->getNestedTransactionsCount()); - - // Rollback - $this->wrapper->rollback(); - self::assertFalse($this->wrapper->inTransaction()); - self::assertSame(0, $this->wrapper->getNestedTransactionsCount()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback() - */ - public function testRollbackDisconnectedThrowsException() - { - $this->wrapper->disconnect(); - - $this->expectException('\Zend\Db\Adapter\Exception\RuntimeException'); - $this->expectExceptionMessage('Must be connected before you can rollback'); - $this->wrapper->rollback(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback() - */ - public function testRollbackReturnsInstanceOfConnection() - { - $this->wrapper->beginTransaction(); - self::assertInstanceOf('\Zend\Db\Adapter\Driver\Pdo\Connection', $this->wrapper->rollback()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - */ - public function testRollbackSetsInTransactionAtFalse() - { - $this->wrapper->beginTransaction(); - $this->wrapper->rollback(); - self::assertFalse($this->wrapper->inTransaction()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::rollback() - */ - public function testRollbackWithoutBeginThrowsException() - { - $this->expectException('\Zend\Db\Adapter\Exception\RuntimeException'); - $this->expectExceptionMessage('Must call beginTransaction() before you can rollback'); - $this->wrapper->rollback(); - } - - /** - * Standalone commit after a SET autocommit=0; - * - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::inTransaction() - * @covers \Zend\Db\Adapter\Driver\Pdo\Connection::commit() - */ - public function testStandaloneCommit() - { - self::assertFalse($this->wrapper->inTransaction()); - self::assertSame(0, $this->wrapper->getNestedTransactionsCount()); - - $this->wrapper->commit(); - - self::assertFalse($this->wrapper->inTransaction()); - self::assertSame(0, $this->wrapper->getNestedTransactionsCount()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/OracleRowCounterTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/OracleRowCounterTest.php deleted file mode 100644 index 3e0b189b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/OracleRowCounterTest.php +++ /dev/null @@ -1,133 +0,0 @@ -rowCounter = new OracleRowCounter(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\OracleRowCounter::getName - */ - public function testGetName() - { - self::assertEquals('OracleRowCounter', $this->rowCounter->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\OracleRowCounter::getCountForStatement - */ - public function testGetCountForStatement() - { - $statement = $this->getMockStatement('SELECT XXX', 5); - $statement->expects($this->once())->method('prepare') - ->with($this->equalTo('SELECT COUNT(*) as "count" FROM (SELECT XXX)')); - - $count = $this->rowCounter->getCountForStatement($statement); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\OracleRowCounter::getCountForSql - */ - public function testGetCountForSql() - { - $this->rowCounter->setDriver($this->getMockDriver(5)); - $count = $this->rowCounter->getCountForSql('SELECT XXX'); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\OracleRowCounter::getRowCountClosure - */ - public function testGetRowCountClosure() - { - $stmt = $this->getMockStatement('SELECT XXX', 5); - - /** @var \Closure $closure */ - $closure = $this->rowCounter->getRowCountClosure($stmt); - self::assertInstanceOf('Closure', $closure); - self::assertEquals(5, $closure()); - } - - protected function getMockStatement($sql, $returnValue) - { - /** @var \Zend\Db\Adapter\Driver\Pdo\Statement|\PHPUnit_Framework_MockObject_MockObject $statement */ - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Statement') - ->setMethods(['prepare', 'execute']) - ->disableOriginalConstructor() - ->getMock(); - - // mock PDOStatement with stdClass - $resource = $this->getMockBuilder('stdClass') - ->setMethods(['fetch']) - ->getMock(); - $resource->expects($this->once()) - ->method('fetch') - ->will($this->returnValue(['count' => $returnValue])); - - // mock the result - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $result->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($resource)); - - $statement->setSql($sql); - $statement->expects($this->once()) - ->method('execute') - ->will($this->returnValue($result)); - - return $statement; - } - - protected function getMockDriver($returnValue) - { - $pdoStatement = $this->getMockBuilder('stdClass') - ->setMethods(['fetch']) - ->disableOriginalConstructor() - ->getMock(); // stdClass can be used here - $pdoStatement->expects($this->once()) - ->method('fetch') - ->will($this->returnValue(['count' => $returnValue])); - - $pdoConnection = $this->getMockBuilder('stdClass') - ->setMethods(['query']) - ->getMock(); - $pdoConnection->expects($this->once()) - ->method('query') - ->will($this->returnValue($pdoStatement)); - - $connection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $connection->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($pdoConnection)); - - $driver = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Pdo') - ->setMethods(['getConnection']) - ->disableOriginalConstructor() - ->getMock(); - $driver->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($connection)); - - return $driver; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/SqliteRowCounterTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/SqliteRowCounterTest.php deleted file mode 100644 index 5823885a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/Feature/SqliteRowCounterTest.php +++ /dev/null @@ -1,133 +0,0 @@ -rowCounter = new SqliteRowCounter(); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\SqliteRowCounter::getName - */ - public function testGetName() - { - self::assertEquals('SqliteRowCounter', $this->rowCounter->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\SqliteRowCounter::getCountForStatement - */ - public function testGetCountForStatement() - { - $statement = $this->getMockStatement('SELECT XXX', 5); - $statement->expects($this->once())->method('prepare') - ->with($this->equalTo('SELECT COUNT(*) as "count" FROM (SELECT XXX)')); - - $count = $this->rowCounter->getCountForStatement($statement); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\SqliteRowCounter::getCountForSql - */ - public function testGetCountForSql() - { - $this->rowCounter->setDriver($this->getMockDriver(5)); - $count = $this->rowCounter->getCountForSql('SELECT XXX'); - self::assertEquals(5, $count); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Feature\SqliteRowCounter::getRowCountClosure - */ - public function testGetRowCountClosure() - { - $stmt = $this->getMockStatement('SELECT XXX', 5); - - /** @var \Closure $closure */ - $closure = $this->rowCounter->getRowCountClosure($stmt); - self::assertInstanceOf('Closure', $closure); - self::assertEquals(5, $closure()); - } - - protected function getMockStatement($sql, $returnValue) - { - /** @var \Zend\Db\Adapter\Driver\Pdo\Statement|\PHPUnit_Framework_MockObject_MockObject $statement */ - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Statement') - ->setMethods(['prepare', 'execute']) - ->disableOriginalConstructor() - ->getMock(); - - // mock PDOStatement with stdClass - $resource = $this->getMockBuilder('stdClass') - ->setMethods(['fetch']) - ->getMock(); - $resource->expects($this->once()) - ->method('fetch') - ->will($this->returnValue(['count' => $returnValue])); - - // mock the result - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $result->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($resource)); - - $statement->setSql($sql); - $statement->expects($this->once()) - ->method('execute') - ->will($this->returnValue($result)); - - return $statement; - } - - protected function getMockDriver($returnValue) - { - $pdoStatement = $this->getMockBuilder('stdClass') - ->setMethods(['fetch']) - ->disableOriginalConstructor() - ->getMock(); // stdClass can be used here - $pdoStatement->expects($this->once()) - ->method('fetch') - ->will($this->returnValue(['count' => $returnValue])); - - $pdoConnection = $this->getMockBuilder('stdClass') - ->setMethods(['query']) - ->getMock(); - $pdoConnection->expects($this->once()) - ->method('query') - ->will($this->returnValue($pdoStatement)); - - $connection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $connection->expects($this->once()) - ->method('getResource') - ->will($this->returnValue($pdoConnection)); - - $driver = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Pdo') - ->setMethods(['getConnection']) - ->disableOriginalConstructor() - ->getMock(); - $driver->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($connection)); - - return $driver; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/PdoTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/PdoTest.php deleted file mode 100644 index fb4f08d4..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/PdoTest.php +++ /dev/null @@ -1,87 +0,0 @@ -pdo = new Pdo([]); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Pdo::getDatabasePlatformName - */ - public function testGetDatabasePlatformName() - { - // Test platform name for SqlServer - $this->pdo->getConnection()->setConnectionParameters(['pdodriver' => 'sqlsrv']); - self::assertEquals('SqlServer', $this->pdo->getDatabasePlatformName()); - self::assertEquals('SQLServer', $this->pdo->getDatabasePlatformName(DriverInterface::NAME_FORMAT_NATURAL)); - } - - public function getParamsAndType() - { - return [ - [ 'foo', null, ':foo' ], - [ 'foo_bar', null, ':foo_bar' ], - [ '123foo', null, ':123foo' ], - [ 1, null, '?' ], - [ '1', null, '?' ], - [ 'foo', Pdo::PARAMETERIZATION_NAMED, ':foo' ], - [ 'foo_bar', Pdo::PARAMETERIZATION_NAMED, ':foo_bar' ], - [ '123foo', Pdo::PARAMETERIZATION_NAMED, ':123foo' ], - [ 1, Pdo::PARAMETERIZATION_NAMED, ':1' ], - [ '1', Pdo::PARAMETERIZATION_NAMED, ':1' ], - [ ':foo', null, ':foo' ], - ]; - } - - /** - * @dataProvider getParamsAndType - */ - public function testFormatParameterName($name, $type, $expected) - { - $result = $this->pdo->formatParameterName($name, $type); - $this->assertEquals($expected, $result); - } - - public function getInvalidParamName() - { - return [ - [ 'foo%' ], - [ 'foo-' ], - [ 'foo$' ], - [ 'foo0!' ] - ]; - } - - /** - * @dataProvider getInvalidParamName - * @expectedException Zend\Db\Exception\RuntimeException - */ - public function testFormatParameterNameWithInvalidCharacters($name) - { - $this->pdo->formatParameterName($name); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ResultTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ResultTest.php deleted file mode 100644 index d806000d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/ResultTest.php +++ /dev/null @@ -1,72 +0,0 @@ -getMockBuilder('PDOStatement')->getMock(); - $stub->expects($this->any()) - ->method('fetch') - ->will($this->returnCallback(function () { - return uniqid(); - })); - - $result = new Result(); - $result->initialize($stub, null); - - self::assertEquals($result->current(), $result->current()); - } - - public function testFetchModeException() - { - $result = new Result(); - - $this->expectException('\Zend\Db\Adapter\Exception\InvalidArgumentException'); - $result->setFetchMode(11); - } - - /** - * Tests whether the fetch mode was set properly and - */ - public function testFetchModeAnonymousObject() - { - $stub = $this->getMockBuilder('PDOStatement')->getMock(); - $stub->expects($this->any()) - ->method('fetch') - ->will($this->returnCallback(function () { - return new stdClass; - })); - - $result = new Result(); - $result->initialize($stub, null); - $result->setFetchMode(\PDO::FETCH_OBJ); - - self::assertEquals(5, $result->getFetchMode()); - self::assertInstanceOf('stdClass', $result->current()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementIntegrationTest.php deleted file mode 100644 index a25f1286..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementIntegrationTest.php +++ /dev/null @@ -1,74 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Pdo') - ->setMethods(['createResult']) - ->disableOriginalConstructor() - ->getMock(); - - $this->statement = new Statement; - $this->statement->setDriver($driver); - $this->statement->initialize(new TestAsset\CtorlessPdo( - $this->pdoStatementMock = $this->getMockBuilder('PDOStatement') - ->setMethods(['execute', 'bindParam']) - ->getMock() - )); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - public function testStatementExecuteWillConvertPhpBoolToPdoBoolWhenBinding() - { - $this->pdoStatementMock->expects($this->any())->method('bindParam')->with( - $this->equalTo(':foo'), - $this->equalTo(false), - $this->equalTo(\PDO::PARAM_BOOL) - ); - $this->statement->execute(['foo' => false]); - } - - public function testStatementExecuteWillUsePdoStrByDefaultWhenBinding() - { - $this->pdoStatementMock->expects($this->any())->method('bindParam')->with( - $this->equalTo(':foo'), - $this->equalTo('bar'), - $this->equalTo(\PDO::PARAM_STR) - ); - $this->statement->execute(['foo' => 'bar']); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementTest.php deleted file mode 100644 index d103b494..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/StatementTest.php +++ /dev/null @@ -1,131 +0,0 @@ -statement = new Statement; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->statement, $this->statement->setDriver(new Pdo([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::setParameterContainer - */ - public function testSetParameterContainer() - { - self::assertSame($this->statement, $this->statement->setParameterContainer(new ParameterContainer)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::getParameterContainer - * @todo Implement testGetParameterContainer(). - */ - public function testGetParameterContainer() - { - $container = new ParameterContainer; - $this->statement->setParameterContainer($container); - self::assertSame($container, $this->statement->getParameterContainer()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::getResource - */ - public function testGetResource() - { - $pdo = new TestAsset\SqliteMemoryPdo(); - $stmt = $pdo->prepare('SELECT 1'); - $this->statement->setResource($stmt); - - self::assertSame($stmt, $this->statement->getResource()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::setSql - */ - public function testSetSql() - { - $this->statement->setSql('SELECT 1'); - self::assertEquals('SELECT 1', $this->statement->getSql()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::getSql - */ - public function testGetSql() - { - $this->statement->setSql('SELECT 1'); - self::assertEquals('SELECT 1', $this->statement->getSql()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::prepare - * @todo Implement testPrepare(). - */ - public function testPrepare() - { - $this->statement->initialize(new TestAsset\SqliteMemoryPdo()); - self::assertNull($this->statement->prepare('SELECT 1')); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::isPrepared - */ - public function testIsPrepared() - { - self::assertFalse($this->statement->isPrepared()); - $this->statement->initialize(new TestAsset\SqliteMemoryPdo()); - $this->statement->prepare('SELECT 1'); - self::assertTrue($this->statement->isPrepared()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pdo\Statement::execute - */ - public function testExecute() - { - $this->statement->setDriver(new Pdo(new Connection($pdo = new TestAsset\SqliteMemoryPdo()))); - $this->statement->initialize($pdo); - $this->statement->prepare('SELECT 1'); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Pdo\Result', $this->statement->execute()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/CtorlessPdo.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/CtorlessPdo.php deleted file mode 100644 index 8acc9bc6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/CtorlessPdo.php +++ /dev/null @@ -1,25 +0,0 @@ -mockStatement = $mockStatement; - } - - public function prepare($sql, $options = null) - { - return $this->mockStatement; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php deleted file mode 100644 index b1e28719..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php +++ /dev/null @@ -1,31 +0,0 @@ -exec($sql)) { - throw new \Exception(sprintf( - "Error: %s, %s", - $this->errorCode(), - implode(",", $this->errorInfo()) - )); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/ConnectionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/ConnectionTest.php deleted file mode 100644 index 7e5bca4a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/ConnectionTest.php +++ /dev/null @@ -1,168 +0,0 @@ -connection = new Connection(); - } - - /** - * Test getResource method if it tries to connect to the database. - * - * @covers \Zend\Db\Adapter\Driver\Pgsql\Connection::getResource - */ - public function testResource() - { - if (! extension_loaded('pgsql')) { - $this->markTestSkipped('pgsql extension not loaded'); - } - - try { - $resource = $this->connection->getResource(); - // connected with empty string - self::assertInternalType('resource', $resource); - } catch (AdapterException\RuntimeException $exc) { - // If it throws an exception it has failed to connect - $this->expectException('Zend\Db\Adapter\Exception\RuntimeException'); - throw $exc; - } - } - - /** - * Test disconnect method to return instance of ConnectionInterface - */ - public function testDisconnect() - { - include_once 'pgsqlMockFunctions.php'; - self::assertSame($this->connection, $this->connection->disconnect()); - } - - /** - * @group 6760 - * @group 6787 - */ - public function testGetConnectionStringEncodeSpecialSymbol() - { - $connectionParameters = [ - 'driver' => 'pgsql', - 'host' => 'localhost', - 'post' => '5432', - 'dbname' => 'test', - 'username' => 'test', - 'password' => 'test123!', - ]; - - $this->connection->setConnectionParameters($connectionParameters); - - $getConnectionString = new ReflectionMethod( - 'Zend\Db\Adapter\Driver\Pgsql\Connection', - 'getConnectionString' - ); - - $getConnectionString->setAccessible(true); - - self::assertEquals( - 'host=localhost user=test password=test123! dbname=test', - $getConnectionString->invoke($this->connection) - ); - } - - public function testSetConnectionTypeException() - { - if (! extension_loaded('pgsql')) { - $this->markTestSkipped('pgsql extension not loaded'); - } - - $this->expectException('\Zend\Db\Adapter\Exception\InvalidArgumentException'); - $this->connection->setType(3); - } - - /** - * Test the connection type setter - */ - public function testSetConnectionType() - { - if (! extension_loaded('pgsql')) { - $this->markTestSkipped('pgsql extension not loaded'); - } - $type = PGSQL_CONNECT_FORCE_NEW; - $this->connection->setType($type); - self::assertEquals($type, self::readAttribute($this->connection, 'type')); - } - - /** - * @runInSeparateProcess - */ - public function testSetCharset() - { - if (! extension_loaded('pgsql')) { - $this->markTestSkipped('pgsql extension not loaded'); - } - - $this->connection->setConnectionParameters([ - 'driver' => 'pgsql', - 'host' => 'localhost', - 'post' => '5432', - 'dbname' => 'zenddb_test', - 'username' => 'postgres', - 'password' => 'postgres', - 'charset' => 'SQL_ASCII', - ]); - - try { - $this->connection->connect(); - } catch (AdapterException\RuntimeException $e) { - $this->markTestSkipped('Skipping pgsql charset test due to inability to connecto to database'); - } - - self::assertEquals('SQL_ASCII', pg_client_encoding($this->connection->getResource())); - } - - /** - * @runInSeparateProcess - */ - public function testSetInvalidCharset() - { - if (! extension_loaded('pgsql')) { - $this->markTestSkipped('pgsql extension not loaded'); - } - - $this->expectException('Zend\Db\Adapter\Exception\RuntimeException'); - - $this->connection->setConnectionParameters([ - 'driver' => 'pgsql', - 'host' => 'localhost', - 'post' => '5432', - 'dbname' => 'zenddb_test', - 'username' => 'postgres', - 'password' => 'postgres', - 'charset' => 'FOOBAR', - ]); - - $this->connection->connect(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/PgsqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/PgsqlTest.php deleted file mode 100644 index dd921108..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/PgsqlTest.php +++ /dev/null @@ -1,178 +0,0 @@ -pgsql = new Pgsql([]); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::checkEnvironment - */ - public function testCheckEnvironment() - { - if (! extension_loaded('pgsql')) { - $this->expectException('Zend\Db\Adapter\Exception\RuntimeException'); - } - $this->pgsql->checkEnvironment(); - self::assertTrue(true, 'No exception was thrown'); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerConnection - */ - public function testRegisterConnection() - { - $mockConnection = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Pgsql\Connection', - [[]], - '', - true, - true, - true, - ['setDriver'] - ); - $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql)); - self::assertSame($this->pgsql, $this->pgsql->registerConnection($mockConnection)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerStatementPrototype - */ - public function testRegisterStatementPrototype() - { - $this->pgsql = new Pgsql([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Pgsql\Statement', - [], - '', - true, - true, - true, - ['setDriver'] - ); - $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql)); - self::assertSame($this->pgsql, $this->pgsql->registerStatementPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerResultPrototype - */ - public function testRegisterResultPrototype() - { - $this->pgsql = new Pgsql([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Pgsql\Result', - [], - '', - true, - true, - true, - ['setDriver'] - ); - self::assertSame($this->pgsql, $this->pgsql->registerResultPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::getDatabasePlatformName - */ - public function testGetDatabasePlatformName() - { - $this->pgsql = new Pgsql([]); - self::assertEquals('Postgresql', $this->pgsql->getDatabasePlatformName()); - self::assertEquals('PostgreSQL', $this->pgsql->getDatabasePlatformName(Pgsql::NAME_FORMAT_NATURAL)); - } - - /** - * @depends testRegisterConnection - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::getConnection - */ - public function testGetConnection($mockConnection) - { - $conn = new \Zend\Db\Adapter\Driver\Pgsql\Connection([]); - $this->pgsql->registerConnection($conn); - self::assertSame($conn, $this->pgsql->getConnection()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::createStatement - * @todo Implement testGetPrepareType(). - */ - public function testCreateStatement() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::createResult - * @todo Implement testGetPrepareType(). - */ - public function testCreateResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::getPrepareType - * @todo Implement testGetPrepareType(). - */ - public function testGetPrepareType() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::formatParameterName - * @todo Implement testFormatParameterName(). - */ - public function testFormatParameterName() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Pgsql\Pgsql::getLastGeneratedValue - * @todo Implement testGetLastGeneratedValue(). - */ - public function testGetLastGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/pgsqlMockFunctions.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/pgsqlMockFunctions.php deleted file mode 100644 index 40d408cf..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Pgsql/pgsqlMockFunctions.php +++ /dev/null @@ -1,15 +0,0 @@ - 'TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_HOSTNAME', - 'username' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_USERNAME', - 'password' => 'TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV_PASSWORD', - ]; - protected $adapters; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - if (! getenv('TESTS_ZEND_DB_ADAPTER_DRIVER_SQLSRV')) { - $this->markTestSkipped('SQLSRV tests are not enabled'); - } - foreach ($this->variables as $name => $value) { - if (! getenv($value)) { - $this->markTestSkipped( - 'Missing required variable ' . $value . ' from phpunit.xml for this integration test' - ); - } - $this->variables[$name] = getenv($value); - } - - if (! extension_loaded('sqlsrv')) { - $this->fail('The phpunit group integration-sqlsrv was enabled, but the extension is not loaded.'); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionIntegrationTest.php deleted file mode 100644 index 92f54bbe..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionIntegrationTest.php +++ /dev/null @@ -1,192 +0,0 @@ -variables); - self::assertInternalType('string', $connection->getCurrentSchema()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::setResource - */ - public function testSetResource() - { - $resource = sqlsrv_connect( - $this->variables['hostname'], - [ - 'UID' => $this->variables['username'], - 'PWD' => $this->variables['password'], - ] - ); - $connection = new Connection([]); - self::assertSame($connection, $connection->setResource($resource)); - - $connection->disconnect(); - unset($connection); - unset($resource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::getResource - */ - public function testGetResource() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertInternalType('resource', $connection->getResource()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::connect - */ - public function testConnect() - { - $connection = new Connection($this->variables); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::isConnected - */ - public function testIsConnected() - { - $connection = new Connection($this->variables); - self::assertFalse($connection->isConnected()); - self::assertSame($connection, $connection->connect()); - self::assertTrue($connection->isConnected()); - - $connection->disconnect(); - unset($connection); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::disconnect - */ - public function testDisconnect() - { - $connection = new Connection($this->variables); - $connection->connect(); - self::assertTrue($connection->isConnected()); - $connection->disconnect(); - self::assertFalse($connection->isConnected()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::beginTransaction - * @todo Implement testBeginTransaction(). - */ - public function testBeginTransaction() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::commit - * @todo Implement testCommit(). - */ - public function testCommit() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::rollback - * @todo Implement testRollback(). - */ - public function testRollback() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::execute - */ - public function testExecute() - { - $sqlsrv = new Sqlsrv($this->variables); - $connection = $sqlsrv->getConnection(); - - $result = $connection->execute('SELECT \'foo\''); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Result', $result); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::prepare - */ - public function testPrepare() - { - $sqlsrv = new Sqlsrv($this->variables); - $connection = $sqlsrv->getConnection(); - - $statement = $connection->prepare('SELECT \'foo\''); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Statement', $statement); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::getLastGeneratedValue - */ - public function testGetLastGeneratedValue() - { - $this->markTestIncomplete('Need to create a temporary sequence.'); - $connection = new Connection($this->variables); - $connection->getLastGeneratedValue(); - } - - /** - * @group zf3469 - */ - public function testConnectReturnsConnectionWhenResourceSet() - { - $resource = sqlsrv_connect( - $this->variables['hostname'], - [ - 'UID' => $this->variables['username'], - 'PWD' => $this->variables['password'], - ] - ); - $connection = new Connection([]); - $connection->setResource($resource); - self::assertSame($connection, $connection->connect()); - - $connection->disconnect(); - unset($connection); - unset($resource); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionTest.php deleted file mode 100644 index d89015c0..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ConnectionTest.php +++ /dev/null @@ -1,64 +0,0 @@ -connection = new Connection([]); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->connection, $this->connection->setDriver(new Sqlsrv([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::setConnectionParameters - */ - public function testSetConnectionParameters() - { - self::assertEquals($this->connection, $this->connection->setConnectionParameters([])); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Connection::getConnectionParameters - */ - public function testGetConnectionParameters() - { - $this->connection->setConnectionParameters(['foo' => 'bar']); - self::assertEquals(['foo' => 'bar'], $this->connection->getConnectionParameters()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/PdoSqlSrvIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/PdoSqlSrvIntegrationTest.php deleted file mode 100644 index 7331e2b8..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/PdoSqlSrvIntegrationTest.php +++ /dev/null @@ -1,29 +0,0 @@ -adapters['pdo_sqlsrv']); - - $stmt = $driver->createStatement('SELECT ? as col_one'); - $result = $stmt->execute(['a']); - $row = $result->current(); - $this->assertEquals('a', $row['col_one']); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ResultIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ResultIntegrationTest.php deleted file mode 100644 index d1f5407e..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/ResultIntegrationTest.php +++ /dev/null @@ -1,198 +0,0 @@ -object = new Result; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::initialize - * @todo Implement testInitialize(). - */ - public function testInitialize() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::buffer - * @todo Implement testBuffer(). - */ - public function testBuffer() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::current - * @todo Implement testCurrent(). - */ - public function testCurrent() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::next - * @todo Implement testNext(). - */ - public function testNext() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::key - * @todo Implement testKey(). - */ - public function testKey() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::rewind - * @todo Implement testRewind(). - */ - public function testRewind() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::valid - * @todo Implement testValid(). - */ - public function testValid() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::count - * @todo Implement testCount(). - */ - public function testCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::getFieldCount - * @todo Implement testGetFieldCount(). - */ - public function testGetFieldCount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::isQueryResult - * @todo Implement testIsQueryResult(). - */ - public function testIsQueryResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::getAffectedRows - * @todo Implement testGetAffectedRows(). - */ - public function testGetAffectedRows() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Result::getGeneratedValue - * @todo Implement testGetGeneratedValue(). - */ - public function testGetGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlSrvIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlSrvIntegrationTest.php deleted file mode 100644 index 33f9e5ad..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlSrvIntegrationTest.php +++ /dev/null @@ -1,70 +0,0 @@ -resource = $this->adapters['sqlsrv']; - $this->driver = new Sqlsrv($this->resource); - } - - /** - * @group integration-sqlserver - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::checkEnvironment - */ - public function testCheckEnvironment() - { - $sqlserver = new Sqlsrv([]); - self::assertNull($sqlserver->checkEnvironment()); - } - - public function testCreateStatement() - { - $stmt = $this->driver->createStatement('SELECT 1'); - $this->assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Statement', $stmt); - $stmt = $this->driver->createStatement($this->resource); - $this->assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Statement', $stmt); - $stmt = $this->driver->createStatement(); - $this->assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Statement', $stmt); - - $this->setExpectedException( - 'Zend\Db\Adapter\Exception\InvalidArgumentException', - 'only accepts an SQL string or a Sqlsrv resource' - ); - $this->driver->createStatement(new \stdClass); - } - - public function testParameterizedQuery() - { - $stmt = $this->driver->createStatement('SELECT ? as col_one'); - $result = $stmt->execute(['a']); - $row = $result->current(); - $this->assertEquals('a', $row['col_one']); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php deleted file mode 100644 index a0782518..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php +++ /dev/null @@ -1,166 +0,0 @@ -sqlsrv = new Sqlsrv([]); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::registerConnection - */ - public function testRegisterConnection() - { - $mockConnection = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Sqlsrv\Connection', - [[]], - '', - true, - true, - true, - ['setDriver'] - ); - $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->sqlsrv)); - self::assertSame($this->sqlsrv, $this->sqlsrv->registerConnection($mockConnection)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::registerStatementPrototype - */ - public function testRegisterStatementPrototype() - { - $this->sqlsrv = new Sqlsrv([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Sqlsrv\Statement', - [], - '', - true, - true, - true, - ['setDriver'] - ); - $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->sqlsrv)); - self::assertSame($this->sqlsrv, $this->sqlsrv->registerStatementPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::registerResultPrototype - */ - public function testRegisterResultPrototype() - { - $this->sqlsrv = new Sqlsrv([]); - $mockStatement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Sqlsrv\Result', - [], - '', - true, - true, - true, - ['setDriver'] - ); - self::assertSame($this->sqlsrv, $this->sqlsrv->registerResultPrototype($mockStatement)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::getDatabasePlatformName - */ - public function testGetDatabasePlatformName() - { - $this->sqlsrv = new Sqlsrv([]); - self::assertEquals('SqlServer', $this->sqlsrv->getDatabasePlatformName()); - self::assertEquals('SQLServer', $this->sqlsrv->getDatabasePlatformName(Sqlsrv::NAME_FORMAT_NATURAL)); - } - - /** - * @depends testRegisterConnection - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::getConnection - */ - public function testGetConnection($mockConnection) - { - $conn = new \Zend\Db\Adapter\Driver\Sqlsrv\Connection([]); - $this->sqlsrv->registerConnection($conn); - self::assertSame($conn, $this->sqlsrv->getConnection()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::createStatement - * @todo Implement testGetPrepareType(). - */ - public function testCreateStatement() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::createResult - * @todo Implement testGetPrepareType(). - */ - public function testCreateResult() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::getPrepareType - * @todo Implement testGetPrepareType(). - */ - public function testGetPrepareType() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::formatParameterName - * @todo Implement testFormatParameterName(). - */ - public function testFormatParameterName() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv::getLastGeneratedValue - * @todo Implement testGetLastGeneratedValue(). - */ - public function testGetLastGeneratedValue() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementIntegrationTest.php deleted file mode 100644 index 9769553f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementIntegrationTest.php +++ /dev/null @@ -1,87 +0,0 @@ -variables['hostname'], - ['UID' => $this->variables['username'], 'PWD' => $this->variables['password']] - ); - - $statement = new Statement; - self::assertSame($statement, $statement->initialize($sqlsrvResource)); - unset($stmtResource, $sqlsrvResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::getResource - */ - public function testGetResource() - { - $sqlsrvResource = sqlsrv_connect( - $this->variables['hostname'], - ['UID' => $this->variables['username'], 'PWD' => $this->variables['password']] - ); - - $statement = new Statement; - $statement->initialize($sqlsrvResource); - $statement->prepare("SELECT 'foo'"); - $resource = $statement->getResource(); - self::assertEquals('SQL Server Statement', get_resource_type($resource)); - unset($resource, $sqlsrvResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::prepare - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::isPrepared - */ - public function testPrepare() - { - $sqlsrvResource = sqlsrv_connect( - $this->variables['hostname'], - ['UID' => $this->variables['username'], 'PWD' => $this->variables['password']] - ); - - $statement = new Statement; - $statement->initialize($sqlsrvResource); - self::assertFalse($statement->isPrepared()); - self::assertSame($statement, $statement->prepare("SELECT 'foo'")); - self::assertTrue($statement->isPrepared()); - unset($resource, $sqlsrvResource); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::execute - */ - public function testExecute() - { - $sqlsrv = new Sqlsrv($this->variables); - $statement = $sqlsrv->createStatement("SELECT 'foo'"); - self::assertSame($statement, $statement->prepare()); - - $result = $statement->execute(); - self::assertInstanceOf('Zend\Db\Adapter\Driver\Sqlsrv\Result', $result); - - unset($resource, $sqlsrvResource); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementTest.php deleted file mode 100644 index d9d1bbab..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/Sqlsrv/StatementTest.php +++ /dev/null @@ -1,138 +0,0 @@ -statement = new Statement; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::setDriver - */ - public function testSetDriver() - { - self::assertEquals($this->statement, $this->statement->setDriver(new Sqlsrv([]))); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::setParameterContainer - */ - public function testSetParameterContainer() - { - self::assertSame($this->statement, $this->statement->setParameterContainer(new ParameterContainer)); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::getParameterContainer - */ - public function testGetParameterContainer() - { - $container = new ParameterContainer; - $this->statement->setParameterContainer($container); - self::assertSame($container, $this->statement->getParameterContainer()); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::getResource - * @todo Implement testGetResource(). - */ - public function testGetResource() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::setSql - * @todo Implement testSetSql(). - */ - public function testSetSql() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::getSql - * @todo Implement testGetSql(). - */ - public function testGetSql() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::prepare - * @todo Implement testPrepare(). - */ - public function testPrepare() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::isPrepared - * @todo Implement testIsPrepared(). - */ - public function testIsPrepared() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers \Zend\Db\Adapter\Driver\Sqlsrv\Statement::execute - * @todo Implement testExecute(). - */ - public function testExecute() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/TestAsset/PdoMock.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/TestAsset/PdoMock.php deleted file mode 100644 index da77ce79..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Driver/TestAsset/PdoMock.php +++ /dev/null @@ -1,39 +0,0 @@ -parameterContainer = new ParameterContainer(['foo' => 'bar']); - } - - /** - * @testdox unit test: Test offsetExists() returns proper values via method call and isset() - * @covers \Zend\Db\Adapter\ParameterContainer::offsetExists - */ - public function testOffsetExists() - { - self::assertTrue($this->parameterContainer->offsetExists('foo')); - self::assertTrue(isset($this->parameterContainer['foo'])); - self::assertFalse($this->parameterContainer->offsetExists('bar')); - self::assertFalse(isset($this->parameterContainer['bar'])); - } - - /** - * @testdox unit test: Test offsetGet() returns proper values via method call and array access - * @covers \Zend\Db\Adapter\ParameterContainer::offsetGet - */ - public function testOffsetGet() - { - self::assertEquals('bar', $this->parameterContainer->offsetGet('foo')); - self::assertEquals('bar', $this->parameterContainer['foo']); - - self::assertNull($this->parameterContainer->offsetGet('bar')); - // @todo determine what should come back here - } - - /** - * @testdox unit test: Test offsetSet() works via method call and array access - * @covers \Zend\Db\Adapter\ParameterContainer::offsetSet - */ - public function testOffsetSet() - { - $this->parameterContainer->offsetSet('boo', 'baz'); - self::assertEquals('baz', $this->parameterContainer->offsetGet('boo')); - - $this->parameterContainer->offsetSet('1', 'book', ParameterContainer::TYPE_STRING, 4); - self::assertEquals( - ['foo' => 'bar', 'boo' => 'baz', '1' => 'book'], - $this->parameterContainer->getNamedArray() - ); - - self::assertEquals('string', $this->parameterContainer->offsetGetErrata('1')); - self::assertEquals(4, $this->parameterContainer->offsetGetMaxLength('1')); - - // test that setting an index applies to correct named parameter - $this->parameterContainer[0] = 'Zero'; - $this->parameterContainer[1] = 'One'; - self::assertEquals( - ['foo' => 'Zero', 'boo' => 'One', '1' => 'book'], - $this->parameterContainer->getNamedArray() - ); - self::assertEquals( - [0 => 'Zero', 1 => 'One', 2 => 'book'], - $this->parameterContainer->getPositionalArray() - ); - - // test no-index applies - $this->parameterContainer['buffer'] = 'A buffer Element'; - $this->parameterContainer[] = 'Second To Last'; - $this->parameterContainer[] = 'Last'; - self::assertEquals( - [ - 'foo' => 'Zero', - 'boo' => 'One', - '1' => 'book', - 'buffer' => 'A buffer Element', - '4' => 'Second To Last', - '5' => 'Last', - ], - $this->parameterContainer->getNamedArray() - ); - self::assertEquals( - [0 => 'Zero', 1 => 'One', 2 => 'book', 3 => 'A buffer Element', 4 => 'Second To Last', 5 => 'Last'], - $this->parameterContainer->getPositionalArray() - ); - } - - /** - * @testdox unit test: Test offsetUnset() works via method call and array access - * @covers \Zend\Db\Adapter\ParameterContainer::offsetUnset - */ - public function testOffsetUnset() - { - $this->parameterContainer->offsetSet('boo', 'baz'); - self::assertTrue($this->parameterContainer->offsetExists('boo')); - - - $this->parameterContainer->offsetUnset('boo'); - self::assertFalse($this->parameterContainer->offsetExists('boo')); - } - - /** - * @testdox unit test: Test setFromArray() will populate the container - * @covers \Zend\Db\Adapter\ParameterContainer::setFromArray - */ - public function testSetFromArray() - { - $this->parameterContainer->setFromArray(['bar' => 'baz']); - self::assertEquals('baz', $this->parameterContainer['bar']); - } - - /** - * @testdox unit test: Test offsetSetMaxLength() will persist errata data - * @covers \Zend\Db\Adapter\ParameterContainer::offsetSetMaxLength - * @testdox unit test: Test offsetGetMaxLength() return persisted errata data, if it exists - * @covers \Zend\Db\Adapter\ParameterContainer::offsetGetMaxLength - */ - public function testOffsetSetAndGetMaxLength() - { - $this->parameterContainer->offsetSetMaxLength('foo', 100); - self::assertEquals(100, $this->parameterContainer->offsetGetMaxLength('foo')); - } - - /** - * @testdox unit test: Test offsetHasMaxLength() will check if errata exists for a particular key - * @covers \Zend\Db\Adapter\ParameterContainer::offsetHasMaxLength - */ - public function testOffsetHasMaxLength() - { - $this->parameterContainer->offsetSetMaxLength('foo', 100); - self::assertTrue($this->parameterContainer->offsetHasMaxLength('foo')); - } - - /** - * @testdox unit test: Test offsetUnsetMaxLength() will unset data for a particular key - * @covers \Zend\Db\Adapter\ParameterContainer::offsetUnsetMaxLength - */ - public function testOffsetUnsetMaxLength() - { - $this->parameterContainer->offsetSetMaxLength('foo', 100); - $this->parameterContainer->offsetUnsetMaxLength('foo'); - self::assertNull($this->parameterContainer->offsetGetMaxLength('foo')); - } - - /** - * @testdox unit test: Test getMaxLengthIterator() will return an iterator for the errata data - * @covers \Zend\Db\Adapter\ParameterContainer::getMaxLengthIterator - */ - public function testGetMaxLengthIterator() - { - $this->parameterContainer->offsetSetMaxLength('foo', 100); - $data = $this->parameterContainer->getMaxLengthIterator(); - self::assertInstanceOf('ArrayIterator', $data); - } - - /** - * @testdox unit test: Test offsetSetErrata() will persist errata data - * @covers \Zend\Db\Adapter\ParameterContainer::offsetSetErrata - */ - public function testOffsetSetErrata() - { - $this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER); - self::assertEquals(ParameterContainer::TYPE_INTEGER, $this->parameterContainer->offsetGetErrata('foo')); - } - - /** - * @testdox unit test: Test offsetGetErrata() return persisted errata data, if it exists - * @covers \Zend\Db\Adapter\ParameterContainer::offsetGetErrata - */ - public function testOffsetGetErrata() - { - $this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER); - self::assertEquals(ParameterContainer::TYPE_INTEGER, $this->parameterContainer->offsetGetErrata('foo')); - } - - /** - * @testdox unit test: Test offsetHasErrata() will check if errata exists for a particular key - * @covers \Zend\Db\Adapter\ParameterContainer::offsetHasErrata - */ - public function testOffsetHasErrata() - { - $this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER); - self::assertTrue($this->parameterContainer->offsetHasErrata('foo')); - } - - /** - * @testdox unit test: Test offsetUnsetErrata() will unset data for a particular key - * @covers \Zend\Db\Adapter\ParameterContainer::offsetUnsetErrata - */ - public function testOffsetUnsetErrata() - { - $this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER); - $this->parameterContainer->offsetUnsetErrata('foo'); - self::assertNull($this->parameterContainer->offsetGetErrata('foo')); - } - - /** - * @testdox unit test: Test getErrataIterator() will return an iterator for the errata data - * @covers \Zend\Db\Adapter\ParameterContainer::getErrataIterator - */ - public function testGetErrataIterator() - { - $this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER); - $data = $this->parameterContainer->getErrataIterator(); - self::assertInstanceOf('ArrayIterator', $data); - } - - /** - * @testdox unit test: Test getNamedArray() - * @covers \Zend\Db\Adapter\ParameterContainer::getNamedArray - */ - public function testGetNamedArray() - { - $data = $this->parameterContainer->getNamedArray(); - self::assertEquals(['foo' => 'bar'], $data); - } - - /** - * @testdox unit test: Test count() returns the proper count - * @covers \Zend\Db\Adapter\ParameterContainer::count - */ - public function testCount() - { - self::assertEquals(1, $this->parameterContainer->count()); - } - - /** - * @testdox unit test: Test current() returns the current element when used as an iterator - * @covers \Zend\Db\Adapter\ParameterContainer::current - */ - public function testCurrent() - { - $value = $this->parameterContainer->current(); - self::assertEquals('bar', $value); - } - - /** - * @testdox unit test: Test next() increases the pointer when used as an iterator - * @covers \Zend\Db\Adapter\ParameterContainer::next - */ - public function testNext() - { - $this->parameterContainer['bar'] = 'baz'; - $this->parameterContainer->next(); - self::assertEquals('baz', $this->parameterContainer->current()); - } - - /** - * @testdox unit test: Test key() returns the name of the current item's name - * @covers \Zend\Db\Adapter\ParameterContainer::key - */ - public function testKey() - { - self::assertEquals('foo', $this->parameterContainer->key()); - } - - /** - * @testdox unit test: Test valid() returns whether the iterators current position is valid - * @covers \Zend\Db\Adapter\ParameterContainer::valid - */ - public function testValid() - { - self::assertTrue($this->parameterContainer->valid()); - $this->parameterContainer->next(); - self::assertFalse($this->parameterContainer->valid()); - } - - /** - * @testdox unit test: Test rewind() resets the iterators pointer - * @covers \Zend\Db\Adapter\ParameterContainer::rewind - */ - public function testRewind() - { - $this->parameterContainer->offsetSet('bar', 'baz'); - $this->parameterContainer->next(); - self::assertEquals('bar', $this->parameterContainer->key()); - $this->parameterContainer->rewind(); - self::assertEquals('foo', $this->parameterContainer->key()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/IbmDb2Test.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/IbmDb2Test.php deleted file mode 100644 index f3cf7934..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/IbmDb2Test.php +++ /dev/null @@ -1,196 +0,0 @@ -platform = new IbmDb2; - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::getName - */ - public function testGetName() - { - self::assertEquals('IBM DB2', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('"', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifier('identifier')); - - $platform = new IbmDb2(['quote_identifiers' => false]); - self::assertEquals('identifier', $platform->quoteIdentifier('identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('"schema"."identifier"', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - - $platform = new IbmDb2(['quote_identifiers' => false]); - self::assertEquals('identifier', $platform->quoteIdentifierChain('identifier')); - self::assertEquals('identifier', $platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('schema.identifier', $platform->quoteIdentifierChain(['schema', 'identifier'])); - - $platform = new IbmDb2(['identifier_separator' => '\\']); - self::assertEquals('"schema"\"identifier"', $platform->quoteIdentifierChain(['schema', 'identifier'])); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - if (! function_exists('db2_escape_string')) { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\IbmDb2 without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - } - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O''Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - "'''; DELETE FROM some_table; -- '", - @$this->platform->quoteValue("'; DELETE FROM some_table; -- ") - ); - self::assertEquals( - "'\\''; \nDELETE FROM some_table; -- '", - @$this->platform->quoteValue("\\'; \nDELETE FROM some_table; -- ") - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O''Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - "'''; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue("'; DELETE FROM some_table; -- ") - ); - self::assertEquals( - "'\\''; \nDELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue("\\'; \nDELETE FROM some_table; -- ") - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteValueList - */ - public function testQuoteValueList() - { - if (! function_exists('db2_escape_string')) { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\IbmDb2 without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - } - self::assertEquals("'Foo O''Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - - $platform = new IbmDb2(['identifier_separator' => '\\']); - self::assertEquals('\\', $platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\IbmDb2::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); - - $platform = new IbmDb2(['quote_identifiers' => false]); - self::assertEquals('foo.bar', $platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('foo as bar', $platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '("foo"."bar" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '("foo"."bar" = "boo".baz) AND ("foo".baz = "boo".baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/MysqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/MysqlTest.php deleted file mode 100644 index a5d8782f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/MysqlTest.php +++ /dev/null @@ -1,242 +0,0 @@ -platform = new Mysql; - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::getName - */ - public function testGetName() - { - self::assertEquals('MySQL', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('`', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('`identifier`', $this->platform->quoteIdentifier('identifier')); - self::assertEquals('`ident``ifier`', $this->platform->quoteIdentifier('ident`ifier')); - self::assertEquals('`namespace:$identifier`', $this->platform->quoteIdentifier('namespace:$identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('`identifier`', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('`identifier`', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('`schema`.`identifier`', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - - self::assertEquals('`ident``ifier`', $this->platform->quoteIdentifierChain('ident`ifier')); - self::assertEquals('`ident``ifier`', $this->platform->quoteIdentifierChain(['ident`ifier'])); - self::assertEquals( - '`schema`.`ident``ifier`', - $this->platform->quoteIdentifierChain(['schema', 'ident`ifier']) - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Mysql without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O\\'Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - - // '\\\'; DELETE FROM some_table; -- ' <- actual below - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Mysql without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Mysql::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('`foo`.`bar`', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('`foo` as `bar`', $this->platform->quoteIdentifierInFragment('foo as bar')); - self::assertEquals('`$TableName`.`bar`', $this->platform->quoteIdentifierInFragment('$TableName.bar')); - self::assertEquals( - '`cmis:$TableName` as `cmis:TableAlias`', - $this->platform->quoteIdentifierInFragment('cmis:$TableName as cmis:TableAlias') - ); - - $this->assertEquals( - '`foo-bar`.`bar-foo`', - $this->platform->quoteIdentifierInFragment('foo-bar.bar-foo') - ); - $this->assertEquals( - '`foo-bar` as `bar-foo`', - $this->platform->quoteIdentifierInFragment('foo-bar as bar-foo') - ); - $this->assertEquals( - '`$TableName-$ColumnName`.`bar-foo`', - $this->platform->quoteIdentifierInFragment('$TableName-$ColumnName.bar-foo') - ); - $this->assertEquals( - '`cmis:$TableName-$ColumnName` as `cmis:TableAlias-ColumnAlias`', - $this->platform->quoteIdentifierInFragment('cmis:$TableName-$ColumnName as cmis:TableAlias-ColumnAlias') - ); - - // single char words - self::assertEquals( - '(`foo`.`bar` = `boo`.`baz`)', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - self::assertEquals( - '(`foo`.`bar`=`boo`.`baz`)', - $this->platform->quoteIdentifierInFragment('(foo.bar=boo.baz)', ['(', ')', '=']) - ); - self::assertEquals('`foo`=`bar`', $this->platform->quoteIdentifierInFragment('foo=bar', ['='])); - - $this->assertEquals( - '(`foo-bar`.`bar-foo` = `boo-baz`.`baz-boo`)', - $this->platform->quoteIdentifierInFragment('(foo-bar.bar-foo = boo-baz.baz-boo)', ['(', ')', '=']) - ); - $this->assertEquals( - '(`foo-bar`.`bar-foo`=`boo-baz`.`baz-boo`)', - $this->platform->quoteIdentifierInFragment('(foo-bar.bar-foo=boo-baz.baz-boo)', ['(', ')', '=']) - ); - $this->assertEquals( - '`foo-bar`=`bar-foo`', - $this->platform->quoteIdentifierInFragment('foo-bar=bar-foo', ['=']) - ); - - // case insensitive safe words - self::assertEquals( - '(`foo`.`bar` = `boo`.`baz`) AND (`foo`.`baz` = `boo`.`baz`)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - $this->assertEquals( - '(`foo-bar`.`bar-foo` = `boo-baz`.`baz-boo`) AND (`foo-baz`.`baz-foo` = `boo-baz`.`baz-boo`)', - $this->platform->quoteIdentifierInFragment( - '(foo-bar.bar-foo = boo-baz.baz-boo) AND (foo-baz.baz-foo = boo-baz.baz-boo)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '(`foo`.`bar` = `boo`.baz) AND (`foo`.baz = `boo`.baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - - // case insensitive safe words in field - $this->assertEquals( - '(`foo-bar`.`bar-foo` = `boo-baz`.baz-boo) AND (`foo-baz`.`baz-foo` = `boo-baz`.baz-boo)', - $this->platform->quoteIdentifierInFragment( - '(foo-bar.bar-foo = boo-baz.baz-boo) AND (foo-baz.baz-foo = boo-baz.baz-boo)', - ['(', ')', '=', 'and', 'bAz-BOo'] - ) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/OracleTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/OracleTest.php deleted file mode 100644 index ed2d326f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/OracleTest.php +++ /dev/null @@ -1,256 +0,0 @@ -platform = new Oracle; - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::__construct - */ - public function testContructWithOptions() - { - self::assertEquals('"\'test\'.\'test\'"', $this->platform->quoteIdentifier('"test"."test"')); - $plataform1 = new Oracle(['quote_identifiers' => false]); - self::assertEquals('"test"."test"', $plataform1->quoteIdentifier('"test"."test"')); - $plataform2 = new Oracle(['quote_identifiers' => 'false']); - self::assertEquals('"test"."test"', $plataform2->quoteIdentifier('"test"."test"')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::__construct - */ - public function testContructWithDriver() - { - $mockDriver = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Oci8\Oci8', - [[]], - '', - true, - true, - true, - [] - ); - $platform = new Oracle([], $mockDriver); - self::assertEquals($mockDriver, $platform->getDriver()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::setDriver - */ - public function testSetDriver() - { - $mockDriver = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\Oci8\Oci8', - [[]], - '', - true, - true, - true, - [] - ); - $platform = $this->platform->setDriver($mockDriver); - self::assertEquals($mockDriver, $platform->getDriver()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::setDriver - */ - public function testSetDriverInvalid() - { - $this->expectException('Zend\Db\Adapter\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - '$driver must be a Oci8 or Oracle PDO Zend\Db\Adapter\Driver, Oci8 instance, or Oci PDO instance' - ); - $this->platform->setDriver(null); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::getDriver - */ - public function testGetDriver() - { - self::assertNull($this->platform->getDriver()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::getName - */ - public function testGetName() - { - self::assertEquals('Oracle', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('"', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifier('identifier')); - - $platform = new Oracle(['quote_identifiers' => false]); - self::assertEquals('identifier', $platform->quoteIdentifier('identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('"schema"."identifier"', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - - $platform = new Oracle(['quote_identifiers' => false]); - self::assertEquals('identifier', $platform->quoteIdentifierChain('identifier')); - self::assertEquals('identifier', $platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('schema.identifier', $platform->quoteIdentifierChain(['schema', 'identifier'])); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Oracle without ' - . 'extension/driver support can introduce security vulnerabilities in a production environment' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O''Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - '\'\'\'; DELETE FROM some_table; -- \'', - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\''; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O''Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - '\'\'\'; DELETE FROM some_table; -- \'', - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - - // '\\\'; DELETE FROM some_table; -- ' <- actual below - self::assertEquals( - "'\\''; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Oracle without ' - . 'extension/driver support can introduce security vulnerabilities in a production environment' - ); - self::assertEquals("'Foo O''Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Oracle::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); - - $platform = new Oracle(['quote_identifiers' => false]); - self::assertEquals('foo.bar', $platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('foo as bar', $platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '("foo"."bar" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '("foo"."bar" = "boo".baz) AND ("foo".baz = "boo".baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/PostgresqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/PostgresqlTest.php deleted file mode 100644 index ed0bc01d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/PostgresqlTest.php +++ /dev/null @@ -1,184 +0,0 @@ -platform = new Postgresql; - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::getName - */ - public function testGetName() - { - self::assertEquals('PostgreSQL', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('"', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifier('identifier')); - self::assertEquals( - '"identifier ""with"" double-quotes"', - $this->platform->quoteIdentifier('identifier "with" double-quotes') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('"schema"."identifier"', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - self::assertEquals( - '"schema"."identifier ""with"" double-quotes"', - $this->platform->quoteIdentifierChain(['schema', 'identifier "with" double-quotes']) - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Postgresql without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("E'value'", @$this->platform->quoteValue('value')); - self::assertEquals("E'Foo O\\'Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - 'E\'\\\'; DELETE FROM some_table; -- \'', - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "E'\\\\\\'; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("E'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("E'Foo O\\'Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - 'E\'\\\'; DELETE FROM some_table; -- \'', - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - - // '\\\'; DELETE FROM some_table; -- ' <- actual below - self::assertEquals( - "E'\\\\\\'; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Postgresql without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - self::assertEquals("'Foo O\'\'Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '("foo"."bar" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '("foo"."bar" = "boo".baz) AND ("foo".baz = "boo".baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/Sql92Test.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/Sql92Test.php deleted file mode 100644 index 994f95ce..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/Sql92Test.php +++ /dev/null @@ -1,176 +0,0 @@ -platform = new Sql92; - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::getName - */ - public function testGetName() - { - self::assertEquals('SQL92', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('"', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifier('identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('"schema"."identifier"', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value without specific driver level support can introduce security vulnerabilities ' - . 'in a production environment.' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O\\'Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - - // '\\\'; DELETE FROM some_table; -- ' <- actual below - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value without specific driver level support can introduce security vulnerabilities ' - . 'in a production environment.' - ); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sql92::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '("foo"."bar" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '("foo"."bar" = "boo".baz) AND ("foo".baz = "boo".baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqlServerTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqlServerTest.php deleted file mode 100644 index 975c8e09..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqlServerTest.php +++ /dev/null @@ -1,194 +0,0 @@ -platform = new SqlServer; - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::getName - */ - public function testGetName() - { - self::assertEquals('SQLServer', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals(['[', ']'], $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('[identifier]', $this->platform->quoteIdentifier('identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('[identifier]', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('[identifier]', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('[schema].[identifier]', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\SqlServer without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O''Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - "'''; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\''; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O''Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - "'''; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\''; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\SqlServer without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - self::assertEquals("'Foo O''Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('[foo].[bar]', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('[foo] as [bar]', $this->platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '([foo].[bar] = [boo].[baz])', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '([foo].[bar] = [boo].[baz]) AND ([foo].[baz] = [boo].[baz])', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '([foo].[bar] = [boo].baz) AND ([foo].baz = [boo].baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\SqlServer::setDriver - */ - public function testSetDriver() - { - $driver = new Pdo(['pdodriver' => 'sqlsrv']); - $this->platform->setDriver($driver); - } - - public function testPlatformQuotesNullByteCharacter() - { - set_error_handler(function () { - }); - $string = "1\0"; - $value = $this->platform->quoteValue($string); - restore_error_handler(); - self::assertEquals("'1\\000'", $value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqliteTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqliteTest.php deleted file mode 100644 index 5e23176c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/SqliteTest.php +++ /dev/null @@ -1,206 +0,0 @@ -platform = new Sqlite; - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::getName - */ - public function testGetName() - { - self::assertEquals('SQLite', $this->platform->getName()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::getQuoteIdentifierSymbol - */ - public function testGetQuoteIdentifierSymbol() - { - self::assertEquals('"', $this->platform->getQuoteIdentifierSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteIdentifier - */ - public function testQuoteIdentifier() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifier('identifier')); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteIdentifierChain - */ - public function testQuoteIdentifierChain() - { - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain('identifier')); - self::assertEquals('"identifier"', $this->platform->quoteIdentifierChain(['identifier'])); - self::assertEquals('"schema"."identifier"', $this->platform->quoteIdentifierChain(['schema', 'identifier'])); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::getQuoteValueSymbol - */ - public function testGetQuoteValueSymbol() - { - self::assertEquals("'", $this->platform->getQuoteValueSymbol()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteValue - */ - public function testQuoteValueRaisesNoticeWithoutPlatformSupport() - { - $this->expectException(Error\Notice::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Sqlite without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - $this->platform->quoteValue('value'); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteValue - */ - public function testQuoteValue() - { - self::assertEquals("'value'", @$this->platform->quoteValue('value')); - self::assertEquals("'Foo O\\'Bar'", @$this->platform->quoteValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - @$this->platform->quoteValue('\'; DELETE FROM some_table; -- ') - ); - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - @$this->platform->quoteValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteTrustedValue - */ - public function testQuoteTrustedValue() - { - self::assertEquals("'value'", $this->platform->quoteTrustedValue('value')); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteTrustedValue("Foo O'Bar")); - self::assertEquals( - '\'\\\'; DELETE FROM some_table; -- \'', - $this->platform->quoteTrustedValue('\'; DELETE FROM some_table; -- ') - ); - - // '\\\'; DELETE FROM some_table; -- ' <- actual below - self::assertEquals( - "'\\\\\\'; DELETE FROM some_table; -- '", - $this->platform->quoteTrustedValue('\\\'; DELETE FROM some_table; -- ') - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteValueList - */ - public function testQuoteValueList() - { - $this->expectException(Error\Error::class); - $this->expectExceptionMessage( - 'Attempting to quote a value in Zend\Db\Adapter\Platform\Sqlite without extension/driver support can ' - . 'introduce security vulnerabilities in a production environment' - ); - self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteValueList("Foo O'Bar")); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::getIdentifierSeparator - */ - public function testGetIdentifierSeparator() - { - self::assertEquals('.', $this->platform->getIdentifierSeparator()); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteIdentifierInFragment - */ - public function testQuoteIdentifierInFragment() - { - self::assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); - self::assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); - - // single char words - self::assertEquals( - '("foo"."bar" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', ['(', ')', '=']) - ); - - // case insensitive safe words - self::assertEquals( - '("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and'] - ) - ); - - // case insensitive safe words in field - self::assertEquals( - '("foo"."bar" = "boo".baz) AND ("foo".baz = "boo".baz)', - $this->platform->quoteIdentifierInFragment( - '(foo.bar = boo.baz) AND (foo.baz = boo.baz)', - ['(', ')', '=', 'and', 'bAz'] - ) - ); - } - - /** - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteValue - * @covers \Zend\Db\Adapter\Platform\Sqlite::quoteTrustedValue - */ - public function testCanCloseConnectionAfterQuoteValue() - { - // Creating the SQLite database file - $filePath = realpath(__DIR__) . "/_files/sqlite.db"; - if (! file_exists($filePath)) { - touch($filePath); - } - - $driver = new \Zend\Db\Adapter\Driver\Pdo\Pdo([ - 'driver' => 'Pdo_Sqlite', - 'database' => $filePath, - ]); - - $this->platform->setDriver($driver); - - $this->platform->quoteValue("some; random]/ value"); - $this->platform->quoteTrustedValue("some; random]/ value"); - - // Closing the connection so we can delete the file - $driver->getConnection()->disconnect(); - - @unlink($filePath); - - self::assertFileNotExists($filePath); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/_files/.gitkeep b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Platform/_files/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Profiler/ProfilerTest.php b/bundled-libs/zendframework/zend-db/test/unit/Adapter/Profiler/ProfilerTest.php deleted file mode 100644 index 443b33f7..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Adapter/Profiler/ProfilerTest.php +++ /dev/null @@ -1,89 +0,0 @@ -profiler = new Profiler; - } - - /** - * @covers \Zend\Db\Adapter\Profiler\Profiler::profilerStart - */ - public function testProfilerStart() - { - $ret = $this->profiler->profilerStart('SELECT * FROM FOO'); - self::assertSame($this->profiler, $ret); - $ret = $this->profiler->profilerStart(new StatementContainer()); - self::assertSame($this->profiler, $ret); - - $this->expectException('Zend\Db\Adapter\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('profilerStart takes either a StatementContainer or a string'); - $this->profiler->profilerStart(5); - } - - /** - * @covers \Zend\Db\Adapter\Profiler\Profiler::profilerFinish - */ - public function testProfilerFinish() - { - $this->profiler->profilerStart('SELECT * FROM FOO'); - $ret = $this->profiler->profilerFinish(); - self::assertSame($this->profiler, $ret); - - $profiler = new Profiler; - $this->expectException('Zend\Db\Adapter\Exception\RuntimeException'); - $this->expectExceptionMessage('A profile must be started before profilerFinish can be called'); - $profiler->profilerFinish(); - } - - /** - * @covers \Zend\Db\Adapter\Profiler\Profiler::getLastProfile - */ - public function testGetLastProfile() - { - $this->profiler->profilerStart('SELECT * FROM FOO'); - $this->profiler->profilerFinish(); - $profile = $this->profiler->getLastProfile(); - self::assertEquals('SELECT * FROM FOO', $profile['sql']); - self::assertNull($profile['parameters']); - self::assertInternalType('float', $profile['start']); - self::assertInternalType('float', $profile['end']); - self::assertInternalType('float', $profile['elapse']); - } - - /** - * @covers \Zend\Db\Adapter\Profiler\Profiler::getProfiles - */ - public function testGetProfiles() - { - $this->profiler->profilerStart('SELECT * FROM FOO1'); - $this->profiler->profilerFinish(); - $this->profiler->profilerStart('SELECT * FROM FOO2'); - $this->profiler->profilerFinish(); - - self::assertCount(2, $this->profiler->getProfiles()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ConfigProviderTest.php b/bundled-libs/zendframework/zend-db/test/unit/ConfigProviderTest.php deleted file mode 100644 index f955bbc6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ConfigProviderTest.php +++ /dev/null @@ -1,42 +0,0 @@ - [ - Adapter\AdapterAbstractServiceFactory::class, - ], - 'factories' => [ - Adapter\AdapterInterface::class => Adapter\AdapterServiceFactory::class, - ], - 'aliases' => [ - Adapter\Adapter::class => Adapter\AdapterInterface::class, - ], - ]; - - public function testProvidesExpectedConfiguration() - { - $provider = new ConfigProvider(); - self::assertEquals($this->config, $provider->getDependencyConfig()); - return $provider; - } - - /** - * @depends testProvidesExpectedConfiguration - */ - public function testInvocationProvidesDependencyConfiguration(ConfigProvider $provider) - { - self::assertEquals(['dependencies' => $provider->getDependencyConfig()], $provider()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/AbstractSourceTest.php b/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/AbstractSourceTest.php deleted file mode 100644 index 5799c57c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/AbstractSourceTest.php +++ /dev/null @@ -1,80 +0,0 @@ -abstractSourceMock = $this->getMockForAbstractClass( - 'Zend\Db\Metadata\Source\AbstractSource', - [], - '', - false - ); - } - - public function testGetConstraintKeys() - { - $refProp = new \ReflectionProperty($this->abstractSourceMock, 'data'); - $refProp->setAccessible(true); - - // internal data - $data = [ - 'constraint_references' => [ - 'foo_schema' => [ - [ - 'constraint_name' => 'bam_constraint', - 'update_rule' => 'UP', - 'delete_rule' => 'DOWN', - 'referenced_table_name' => 'another_table', - 'referenced_column_name' => 'another_column', - ], - ], - ], - 'constraint_keys' => [ - 'foo_schema' => [ - [ - 'table_name' => 'bar_table', - 'constraint_name' => 'bam_constraint', - 'column_name' => 'a', - 'ordinal_position' => 1, - ], - ], - ], - ]; - - $refProp->setValue($this->abstractSourceMock, $data); - $constraints = $this->abstractSourceMock->getConstraintKeys('bam_constraint', 'bar_table', 'foo_schema'); - self::assertCount(1, $constraints); - - /** - * @var \Zend\Db\Metadata\Object\ConstraintKeyObject $constraintKeyObj - */ - $constraintKeyObj = $constraints[0]; - self::assertInstanceOf('Zend\Db\Metadata\Object\ConstraintKeyObject', $constraintKeyObj); - - // check value object is mapped correctly - self::assertEquals('a', $constraintKeyObj->getColumnName()); - self::assertEquals(1, $constraintKeyObj->getOrdinalPosition()); - self::assertEquals('another_table', $constraintKeyObj->getReferencedTableName()); - self::assertEquals('another_column', $constraintKeyObj->getReferencedColumnName()); - self::assertEquals('UP', $constraintKeyObj->getForeignKeyUpdateRule()); - self::assertEquals('DOWN', $constraintKeyObj->getForeignKeyDeleteRule()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/FactoryTest.php b/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/FactoryTest.php deleted file mode 100644 index 5d70616d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/FactoryTest.php +++ /dev/null @@ -1,65 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Platform\PlatformInterface')->getMock(); - $platform - ->expects($this->any()) - ->method('getName') - ->willReturn($platformName) - ; - - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->disableOriginalConstructor() - ->getMock() - ; - - $adapter - ->expects($this->any()) - ->method('getPlatform') - ->willReturn($platform) - ; - - return $adapter; - }; - - return [ - // Description => [adapter, expected return class] - 'MySQL' => [$createAdapterForPlatform('MySQL'), 'Zend\Db\Metadata\Source\MysqlMetadata'], - 'SQLServer' => [$createAdapterForPlatform('SQLServer'), 'Zend\Db\Metadata\Source\SqlServerMetadata'], - 'SQLite' => [$createAdapterForPlatform('SQLite'), 'Zend\Db\Metadata\Source\SqliteMetadata'], - 'PostgreSQL' => [$createAdapterForPlatform('PostgreSQL'), 'Zend\Db\Metadata\Source\PostgresqlMetadata'], - 'Oracle' => [$createAdapterForPlatform('Oracle'), 'Zend\Db\Metadata\Source\OracleMetadata'], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/OracleMetadataTest.php b/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/OracleMetadataTest.php deleted file mode 100644 index b5dea1fc..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/OracleMetadataTest.php +++ /dev/null @@ -1,55 +0,0 @@ -markTestSkipped('I cannot test without the oci8 extension'); - } - parent::setUp(); - $this->variables['driver'] = 'OCI8'; - $this->adapter = new Adapter($this->variables); - $this->metadata = new OracleMetadata($this->adapter); - } - - public function testGetConstraints() - { - $constraints = $this->metadata->getConstraints(null, 'main'); - self::assertCount(0, $constraints); - self::assertContainsOnlyInstancesOf( - 'Zend\Db\Metadata\Object\ConstraintObject', - $constraints - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/SqliteMetadataTest.php b/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/SqliteMetadataTest.php deleted file mode 100644 index fb001a1c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Metadata/Source/SqliteMetadataTest.php +++ /dev/null @@ -1,102 +0,0 @@ -markTestSkipped('I cannot test without the pdo_sqlite extension'); - } - $this->adapter = new Adapter([ - 'driver' => 'Pdo', - 'dsn' => 'sqlite::memory:', - ]); - $this->metadata = new SqliteMetadata($this->adapter); - } - - public function testGetSchemas() - { - $schemas = $this->metadata->getSchemas(); - self::assertContains('main', $schemas); - self::assertCount(1, $schemas); - } - - public function testGetTableNames() - { - $tables = $this->metadata->getTableNames('main'); - self::assertCount(0, $tables); - } - - public function testGetColumnNames() - { - $columns = $this->metadata->getColumnNames(null, 'main'); - self::assertCount(0, $columns); - } - - public function testGetConstraints() - { - $constraints = $this->metadata->getConstraints(null, 'main'); - self::assertCount(0, $constraints); - self::assertContainsOnlyInstancesOf( - 'Zend\Db\Metadata\Object\ConstraintObject', - $constraints - ); - } - - /** - * @group ZF2-3719 - */ - public function testGetConstraintKeys() - { - $keys = $this->metadata->getConstraintKeys( - null, - null, - 'main' - ); - self::assertCount(0, $keys); - self::assertContainsOnlyInstancesOf( - 'Zend\Db\Metadata\Object\ConstraintKeyObject', - $keys - ); - } - - public function testGetTriggers() - { - $triggers = $this->metadata->getTriggers('main'); - self::assertCount(0, $triggers); - self::assertContainsOnlyInstancesOf( - 'Zend\Db\Metadata\Object\TriggerObject', - $triggers - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetIntegrationTest.php deleted file mode 100644 index bce66a34..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetIntegrationTest.php +++ /dev/null @@ -1,58 +0,0 @@ -resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - */ - public function testCurrentCallsDataSourceCurrentAsManyTimesWithoutBuffer() - { - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->resultSet->initialize($result); - $result->expects($this->exactly(3))->method('current')->will($this->returnValue(['foo' => 'bar'])); - $value1 = $this->resultSet->current(); - $value2 = $this->resultSet->current(); - $this->resultSet->current(); - self::assertEquals($value1, $value2); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - */ - public function testCurrentCallsDataSourceCurrentOnceWithBuffer() - { - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $this->resultSet->buffer(); - $this->resultSet->initialize($result); - $result->expects($this->once())->method('current')->will($this->returnValue(['foo' => 'bar'])); - $value1 = $this->resultSet->current(); - $value2 = $this->resultSet->current(); - $this->resultSet->current(); - self::assertEquals($value1, $value2); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetTest.php b/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetTest.php deleted file mode 100644 index c4bd5753..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/AbstractResultSetTest.php +++ /dev/null @@ -1,271 +0,0 @@ -resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::initialize - */ - public function testInitialize() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - - self::assertSame($resultSet, $resultSet->initialize([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - - $this->expectException('Zend\Db\ResultSet\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'DataSource provided is not an array, nor does it implement Iterator or IteratorAggregate' - ); - $resultSet->initialize('foo'); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::initialize - */ - public function testInitializeDoesNotCallCount() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $result = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\ResultInterface'); - $result->expects($this->never())->method('count'); - $resultSet->initialize($result); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::initialize - */ - public function testInitializeWithEmptyArray() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - self::assertSame($resultSet, $resultSet->initialize([])); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::buffer - */ - public function testBuffer() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - self::assertSame($resultSet, $resultSet->buffer()); - - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - $resultSet->next(); // start iterator - $this->expectException('Zend\Db\ResultSet\Exception\RuntimeException'); - $this->expectExceptionMessage('Buffering must be enabled before iteration is started'); - $resultSet->buffer(); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::isBuffered - */ - public function testIsBuffered() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - self::assertFalse($resultSet->isBuffered()); - $resultSet->buffer(); - self::assertTrue($resultSet->isBuffered()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::getDataSource - */ - public function testGetDataSource() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertInstanceOf('\ArrayIterator', $resultSet->getDataSource()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::getFieldCount - */ - public function testGetFieldCount() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ])); - self::assertEquals(2, $resultSet->getFieldCount()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::next - */ - public function testNext() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertNull($resultSet->next()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::key - */ - public function testKey() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - $resultSet->next(); - self::assertEquals(1, $resultSet->key()); - $resultSet->next(); - self::assertEquals(2, $resultSet->key()); - $resultSet->next(); - self::assertEquals(3, $resultSet->key()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - */ - public function testCurrent() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertEquals(['id' => 1, 'name' => 'one'], $resultSet->current()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::valid - */ - public function testValid() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertTrue($resultSet->valid()); - $resultSet->next(); - $resultSet->next(); - $resultSet->next(); - self::assertFalse($resultSet->valid()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::rewind - */ - public function testRewind() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertNull($resultSet->rewind()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::count - */ - public function testCount() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertEquals(3, $resultSet->count()); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::toArray - */ - public function testToArray() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - self::assertEquals( - [ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ], - $resultSet->toArray() - ); - } - - /** - * Test multiple iterations with buffer - * @group issue-6845 - */ - public function testBufferIterations() - { - $resultSet = $this->getMockForAbstractClass('Zend\Db\ResultSet\AbstractResultSet'); - $resultSet->initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ['id' => 3, 'name' => 'three'], - ])); - $resultSet->buffer(); - - $data = $resultSet->current(); - self::assertEquals(1, $data['id']); - $resultSet->next(); - $data = $resultSet->current(); - self::assertEquals(2, $data['id']); - - $resultSet->rewind(); - $data = $resultSet->current(); - self::assertEquals(1, $data['id']); - $resultSet->next(); - $data = $resultSet->current(); - self::assertEquals(2, $data['id']); - $resultSet->next(); - $data = $resultSet->current(); - self::assertEquals(3, $data['id']); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetIntegrationTest.php deleted file mode 100644 index 7506e1c6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetIntegrationTest.php +++ /dev/null @@ -1,33 +0,0 @@ -initialize(new \ArrayIterator([ - ['id' => 1, 'name' => 'one'], - ['id' => 2, 'name' => 'two'], - ])); - $hydratingRs->buffer(); - $obj1 = $hydratingRs->current(); - $hydratingRs->rewind(); - $obj2 = $hydratingRs->current(); - self::assertSame($obj1, $obj2); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetTest.php b/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetTest.php deleted file mode 100644 index 9b28b4ca..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/HydratingResultSetTest.php +++ /dev/null @@ -1,102 +0,0 @@ -arraySerializableHydratorClass = class_exists(ArraySerializableHydrator::class) - ? ArraySerializableHydrator::class - : ArraySerializable::class; - - $this->classMethodsHydratorClass = class_exists(ClassMethodsHydrator::class) - ? ClassMethodsHydrator::class - : ClassMethods::class; - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::setObjectPrototype - */ - public function testSetObjectPrototype() - { - $prototype = new \stdClass; - $hydratingRs = new HydratingResultSet; - self::assertSame($hydratingRs, $hydratingRs->setObjectPrototype($prototype)); - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::getObjectPrototype - */ - public function testGetObjectPrototype() - { - $hydratingRs = new HydratingResultSet; - self::assertInstanceOf('ArrayObject', $hydratingRs->getObjectPrototype()); - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::setHydrator - */ - public function testSetHydrator() - { - $hydratingRs = new HydratingResultSet; - $hydratorClass = $this->classMethodsHydratorClass; - self::assertSame($hydratingRs, $hydratingRs->setHydrator(new $hydratorClass)); - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::getHydrator - */ - public function testGetHydrator() - { - $hydratingRs = new HydratingResultSet; - self::assertInstanceOf($this->arraySerializableHydratorClass, $hydratingRs->getHydrator()); - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::current - */ - public function testCurrent() - { - $hydratingRs = new HydratingResultSet; - $hydratingRs->initialize([ - ['id' => 1, 'name' => 'one'], - ]); - $obj = $hydratingRs->current(); - self::assertInstanceOf('ArrayObject', $obj); - } - - /** - * @covers \Zend\Db\ResultSet\HydratingResultSet::toArray - * @todo Implement testToArray(). - */ - public function testToArray() - { - $hydratingRs = new HydratingResultSet; - $hydratingRs->initialize([ - ['id' => 1, 'name' => 'one'], - ]); - $obj = $hydratingRs->toArray(); - self::assertInternalType('array', $obj); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/ResultSetIntegrationTest.php b/bundled-libs/zendframework/zend-db/test/unit/ResultSet/ResultSetIntegrationTest.php deleted file mode 100644 index b92dcbf9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/ResultSet/ResultSetIntegrationTest.php +++ /dev/null @@ -1,251 +0,0 @@ -resultSet = new ResultSet; - } - - public function testRowObjectPrototypeIsPopulatedByRowObjectByDefault() - { - $row = $this->resultSet->getArrayObjectPrototype(); - self::assertInstanceOf('ArrayObject', $row); - } - - public function testRowObjectPrototypeIsMutable() - { - $row = new \ArrayObject(); - $this->resultSet->setArrayObjectPrototype($row); - self::assertSame($row, $this->resultSet->getArrayObjectPrototype()); - } - - public function testRowObjectPrototypeMayBePassedToConstructor() - { - $row = new \ArrayObject(); - $resultSet = new ResultSet(ResultSet::TYPE_ARRAYOBJECT, $row); - self::assertSame($row, $resultSet->getArrayObjectPrototype()); - } - - public function testReturnTypeIsObjectByDefault() - { - self::assertEquals(ResultSet::TYPE_ARRAYOBJECT, $this->resultSet->getReturnType()); - } - - public function invalidReturnTypes() - { - return [ - [1], - [1.0], - [true], - ['string'], - [['foo']], - [new stdClass], - ]; - } - - /** - * @dataProvider invalidReturnTypes - */ - public function testSettingInvalidReturnTypeRaisesException($type) - { - $this->expectException('Zend\Db\ResultSet\Exception\InvalidArgumentException'); - new ResultSet(ResultSet::TYPE_ARRAYOBJECT, $type); - } - - public function testDataSourceIsNullByDefault() - { - self::assertNull($this->resultSet->getDataSource()); - } - - public function testCanProvideIteratorAsDataSource() - { - $it = new SplStack; - $this->resultSet->initialize($it); - self::assertSame($it, $this->resultSet->getDataSource()); - } - - public function testCanProvideArrayAsDataSource() - { - $dataSource = [['foo']]; - $this->resultSet->initialize($dataSource); - $this->assertEquals($dataSource[0], (array) $this->resultSet->current()); - - $returnType = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - $dataSource = [$returnType]; - $this->resultSet->setArrayObjectPrototype($returnType); - $this->resultSet->initialize($dataSource); - $this->assertEquals($dataSource[0], $this->resultSet->current()); - $this->assertContains($dataSource[0], $this->resultSet); - } - - public function testCanProvideIteratorAggregateAsDataSource() - { - $iteratorAggregate = $this->getMockBuilder('IteratorAggregate') - ->setMethods(['getIterator']) - ->setConstructorArgs([new SplStack]) - ->getMock(); - $iteratorAggregate->expects($this->any())->method('getIterator')->will($this->returnValue($iteratorAggregate)); - $this->resultSet->initialize($iteratorAggregate); - self::assertSame($iteratorAggregate->getIterator(), $this->resultSet->getDataSource()); - } - - /** - * @dataProvider invalidReturnTypes - */ - public function testInvalidDataSourceRaisesException($dataSource) - { - if (is_array($dataSource)) { - // this is valid - return; - } - $this->expectException('Zend\Db\ResultSet\Exception\InvalidArgumentException'); - $this->resultSet->initialize($dataSource); - } - - public function testFieldCountIsZeroWithNoDataSourcePresent() - { - self::assertEquals(0, $this->resultSet->getFieldCount()); - } - - public function getArrayDataSource($count) - { - $array = []; - for ($i = 0; $i < $count; $i++) { - $array[] = [ - 'id' => $i, - 'title' => 'title ' . $i, - ]; - } - return new ArrayIterator($array); - } - - public function testFieldCountRepresentsNumberOfFieldsInARowOfData() - { - $resultSet = new ResultSet(ResultSet::TYPE_ARRAY); - $dataSource = $this->getArrayDataSource(10); - $resultSet->initialize($dataSource); - self::assertEquals(2, $resultSet->getFieldCount()); - } - - public function testWhenReturnTypeIsArrayThenIterationReturnsArrays() - { - $resultSet = new ResultSet(ResultSet::TYPE_ARRAY); - $dataSource = $this->getArrayDataSource(10); - $resultSet->initialize($dataSource); - foreach ($resultSet as $index => $row) { - self::assertEquals($dataSource[$index], $row); - } - } - - public function testWhenReturnTypeIsObjectThenIterationReturnsRowObjects() - { - $dataSource = $this->getArrayDataSource(10); - $this->resultSet->initialize($dataSource); - foreach ($this->resultSet as $index => $row) { - self::assertInstanceOf('ArrayObject', $row); - self::assertEquals($dataSource[$index], $row->getArrayCopy()); - } - } - - public function testCountReturnsCountOfRows() - { - $count = rand(3, 75); - $dataSource = $this->getArrayDataSource($count); - $this->resultSet->initialize($dataSource); - self::assertEquals($count, $this->resultSet->count()); - } - - public function testToArrayRaisesExceptionForRowsThatAreNotArraysOrArrayCastable() - { - $count = rand(3, 75); - $dataSource = $this->getArrayDataSource($count); - foreach ($dataSource as $index => $row) { - $dataSource[$index] = (object) $row; - } - $this->resultSet->initialize($dataSource); - $this->expectException('Zend\Db\ResultSet\Exception\RuntimeException'); - $this->resultSet->toArray(); - } - - public function testToArrayCreatesArrayOfArraysRepresentingRows() - { - $count = rand(3, 75); - $dataSource = $this->getArrayDataSource($count); - $this->resultSet->initialize($dataSource); - $test = $this->resultSet->toArray(); - self::assertEquals($dataSource->getArrayCopy(), $test, var_export($test, 1)); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - * @covers \Zend\Db\ResultSet\AbstractResultSet::buffer - */ - public function testCurrentWithBufferingCallsDataSourceCurrentOnce() - { - $mockResult = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockResult->expects($this->once())->method('current')->will($this->returnValue(['foo' => 'bar'])); - - $this->resultSet->initialize($mockResult); - $this->resultSet->buffer(); - $this->resultSet->current(); - - // assertion above will fail if this calls datasource current - $this->resultSet->current(); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - * @covers \Zend\Db\ResultSet\AbstractResultSet::buffer - */ - public function testBufferCalledAfterIterationThrowsException() - { - $this->resultSet->initialize( - $this->prophesize('Zend\Db\Adapter\Driver\ResultInterface')->reveal() - ); - $this->resultSet->current(); - - $this->expectException('Zend\Db\ResultSet\Exception\RuntimeException'); - $this->expectExceptionMessage('Buffering must be enabled before iteration is started'); - $this->resultSet->buffer(); - } - - /** - * @covers \Zend\Db\ResultSet\AbstractResultSet::current - */ - public function testCurrentReturnsNullForNonExistingValues() - { - $mockResult = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockResult->expects($this->once())->method('current')->will($this->returnValue("Not an Array")); - - $this->resultSet->initialize($mockResult); - $this->resultSet->buffer(); - - self::assertNull($this->resultSet->current()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/RowGateway/AbstractRowGatewayTest.php b/bundled-libs/zendframework/zend-db/test/unit/RowGateway/AbstractRowGatewayTest.php deleted file mode 100644 index fca010e0..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/RowGateway/AbstractRowGatewayTest.php +++ /dev/null @@ -1,316 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockResult->expects($this->any())->method('getAffectedRows')->will($this->returnValue(1)); - $this->mockResult = $mockResult; - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult)); - $mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection)); - - // setup mock adapter - $this->mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $this->rowGateway = $this->getMockForAbstractClass('Zend\Db\RowGateway\AbstractRowGateway'); - - $rgPropertyValues = [ - 'primaryKeyColumn' => 'id', - 'table' => 'foo', - 'sql' => new \Zend\Db\Sql\Sql($this->mockAdapter), - ]; - $this->setRowGatewayState($rgPropertyValues); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::offsetSet - */ - public function testOffsetSet() - { - // If we set with an index, both getters should retrieve the same value: - $this->rowGateway['testColumn'] = 'test'; - self::assertEquals('test', $this->rowGateway->testColumn); - self::assertEquals('test', $this->rowGateway['testColumn']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::__set - */ - // @codingStandardsIgnoreStart - public function test__set() - { - // @codingStandardsIgnoreEnd - // If we set with a property, both getters should retrieve the same value: - $this->rowGateway->testColumn = 'test'; - self::assertEquals('test', $this->rowGateway->testColumn); - self::assertEquals('test', $this->rowGateway['testColumn']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::__isset - */ - // @codingStandardsIgnoreStart - public function test__isset() - { - // @codingStandardsIgnoreEnd - // Test isset before and after assigning to a property: - self::assertFalse(isset($this->rowGateway->foo)); - $this->rowGateway->foo = 'bar'; - self::assertTrue(isset($this->rowGateway->foo)); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::offsetExists - */ - public function testOffsetExists() - { - // Test isset before and after assigning to an index: - self::assertFalse(isset($this->rowGateway['foo'])); - $this->rowGateway['foo'] = 'bar'; - self::assertTrue(isset($this->rowGateway['foo'])); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::__unset - */ - // @codingStandardsIgnoreStart - public function test__unset() - { - // @codingStandardsIgnoreEnd - $this->rowGateway->foo = 'bar'; - self::assertEquals('bar', $this->rowGateway->foo); - unset($this->rowGateway->foo); - self::assertEmpty($this->rowGateway->foo); - self::assertEmpty($this->rowGateway['foo']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::offsetUnset - */ - public function testOffsetUnset() - { - $this->rowGateway['foo'] = 'bar'; - self::assertEquals('bar', $this->rowGateway['foo']); - unset($this->rowGateway['foo']); - self::assertEmpty($this->rowGateway->foo); - self::assertEmpty($this->rowGateway['foo']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::offsetGet - */ - public function testOffsetGet() - { - // If we set with an index, both getters should retrieve the same value: - $this->rowGateway['testColumn'] = 'test'; - self::assertEquals('test', $this->rowGateway->testColumn); - self::assertEquals('test', $this->rowGateway['testColumn']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::__get - */ - // @codingStandardsIgnoreStart - public function test__get() - { - // @codingStandardsIgnoreEnd - // If we set with a property, both getters should retrieve the same value: - $this->rowGateway->testColumn = 'test'; - self::assertEquals('test', $this->rowGateway->testColumn); - self::assertEquals('test', $this->rowGateway['testColumn']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::save - */ - public function testSaveInsert() - { - // test insert - $this->mockResult->expects($this->any())->method('current') - ->will($this->returnValue(['id' => 5, 'name' => 'foo'])); - $this->mockResult->expects($this->any())->method('getGeneratedValue')->will($this->returnValue(5)); - $this->rowGateway->populate(['name' => 'foo']); - $this->rowGateway->save(); - self::assertEquals(5, $this->rowGateway->id); - self::assertEquals(5, $this->rowGateway['id']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::save - */ - public function testSaveInsertMultiKey() - { - $this->rowGateway = $this->getMockForAbstractClass('Zend\Db\RowGateway\AbstractRowGateway'); - - $mockSql = $this->getMockForAbstractClass('Zend\Db\Sql\Sql', [$this->mockAdapter]); - - $rgPropertyValues = [ - 'primaryKeyColumn' => ['one', 'two'], - 'table' => 'foo', - 'sql' => $mockSql, - ]; - $this->setRowGatewayState($rgPropertyValues); - - // test insert - $this->mockResult->expects($this->any())->method('current') - ->will($this->returnValue(['one' => 'foo', 'two' => 'bar'])); - - // @todo Need to assert that $where was filled in - - $refRowGateway = new \ReflectionObject($this->rowGateway); - $refRowGatewayProp = $refRowGateway->getProperty('primaryKeyData'); - $refRowGatewayProp->setAccessible(true); - - $this->rowGateway->populate(['one' => 'foo', 'two' => 'bar']); - - self::assertNull($refRowGatewayProp->getValue($this->rowGateway)); - - // save should setup the primaryKeyData - $this->rowGateway->save(); - - self::assertEquals(['one' => 'foo', 'two' => 'bar'], $refRowGatewayProp->getValue($this->rowGateway)); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::save - */ - public function testSaveUpdate() - { - // test update - $this->mockResult->expects($this->any())->method('current') - ->will($this->returnValue(['id' => 6, 'name' => 'foo'])); - $this->rowGateway->populate(['id' => 6, 'name' => 'foo'], true); - $this->rowGateway->save(); - self::assertEquals(6, $this->rowGateway['id']); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::save - */ - public function testSaveUpdateChangingPrimaryKey() - { - // this mock is the select to be used to re-fresh the rowobject's data - $selectMock = $this->getMockBuilder('Zend\Db\Sql\Select') - ->setMethods(['where']) - ->getMock(); - $selectMock->expects($this->once()) - ->method('where') - ->with($this->equalTo(['id' => 7])) - ->will($this->returnValue($selectMock)); - - $sqlMock = $this->getMockBuilder('Zend\Db\Sql\Sql') - ->setMethods(['select']) - ->setConstructorArgs([$this->mockAdapter]) - ->getMock(); - $sqlMock->expects($this->any()) - ->method('select') - ->will($this->returnValue($selectMock)); - - $this->setRowGatewayState(['sql' => $sqlMock]); - - // original mock returning updated data - $this->mockResult->expects($this->any()) - ->method('current') - ->will($this->returnValue(['id' => 7, 'name' => 'fooUpdated'])); - - // populate forces an update in save(), seeds with original data (from db) - $this->rowGateway->populate(['id' => 6, 'name' => 'foo'], true); - $this->rowGateway->id = 7; - $this->rowGateway->save(); - self::assertEquals(['id' => 7, 'name' => 'fooUpdated'], $this->rowGateway->toArray()); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::delete - */ - public function testDelete() - { - $this->rowGateway->foo = 'bar'; - $affectedRows = $this->rowGateway->delete(); - self::assertFalse($this->rowGateway->rowExistsInDatabase()); - self::assertEquals(1, $affectedRows); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::populate - * @covers \Zend\Db\RowGateway\RowGateway::rowExistsInDatabase - */ - public function testPopulate() - { - $this->rowGateway->populate(['id' => 5, 'name' => 'foo']); - self::assertEquals(5, $this->rowGateway['id']); - self::assertEquals('foo', $this->rowGateway['name']); - self::assertFalse($this->rowGateway->rowExistsInDatabase()); - - $this->rowGateway->populate(['id' => 5, 'name' => 'foo'], true); - self::assertTrue($this->rowGateway->rowExistsInDatabase()); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::processPrimaryKeyData - */ - public function testProcessPrimaryKeyData() - { - $this->rowGateway->populate(['id' => 5, 'name' => 'foo'], true); - - $this->expectException('Zend\Db\RowGateway\Exception\RuntimeException'); - $this->expectExceptionMessage('a known key id was not found'); - $this->rowGateway->populate(['boo' => 5, 'name' => 'foo'], true); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::count - */ - public function testCount() - { - $this->rowGateway->populate(['id' => 5, 'name' => 'foo'], true); - self::assertEquals(2, $this->rowGateway->count()); - } - - /** - * @covers \Zend\Db\RowGateway\RowGateway::toArray - */ - public function testToArray() - { - $this->rowGateway->populate(['id' => 5, 'name' => 'foo'], true); - self::assertEquals(['id' => 5, 'name' => 'foo'], $this->rowGateway->toArray()); - } - - protected function setRowGatewayState(array $properties) - { - $refRowGateway = new \ReflectionObject($this->rowGateway); - foreach ($properties as $rgPropertyName => $rgPropertyValue) { - $refRowGatewayProp = $refRowGateway->getProperty($rgPropertyName); - $refRowGatewayProp->setAccessible(true); - $refRowGatewayProp->setValue($this->rowGateway, $rgPropertyValue); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/RowGateway/RowGatewayTest.php b/bundled-libs/zendframework/zend-db/test/unit/RowGateway/RowGatewayTest.php deleted file mode 100644 index a358f513..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/RowGateway/RowGatewayTest.php +++ /dev/null @@ -1,49 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockResult->expects($this->any())->method('getAffectedRows')->will($this->returnValue(1)); - $this->mockResult = $mockResult; - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult)); - - $mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection)); - - // setup mock adapter - $this->mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - } - - public function testEmptyPrimaryKey() - { - $this->expectException('Zend\Db\RowGateway\Exception\RuntimeException'); - $this->expectExceptionMessage('This row object does not have a primary key column set.'); - $this->rowGateway = new RowGateway('', 'foo', $this->mockAdapter); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/AbstractSqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/AbstractSqlTest.php deleted file mode 100644 index 3f2bd4d4..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/AbstractSqlTest.php +++ /dev/null @@ -1,187 +0,0 @@ -abstractSql = $this->getMockForAbstractClass('Zend\Db\Sql\AbstractSql'); - - $this->mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $this->mockDriver - ->expects($this->any()) - ->method('getPrepareType') - ->will($this->returnValue(DriverInterface::PARAMETERIZATION_NAMED)); - $this->mockDriver - ->expects($this->any()) - ->method('formatParameterName') - ->will($this->returnCallback(function ($x) { - return ':' . $x; - })); - } - - /** - * @covers \Zend\Db\Sql\AbstractSql::processExpression - */ - public function testProcessExpressionWithoutParameterContainer() - { - $expression = new Expression('? > ? AND y < ?', ['x', 5, 10], [Expression::TYPE_IDENTIFIER]); - $sqlAndParams = $this->invokeProcessExpressionMethod($expression); - - self::assertEquals("\"x\" > '5' AND y < '10'", $sqlAndParams); - } - - /** - * @covers \Zend\Db\Sql\AbstractSql::processExpression - */ - public function testProcessExpressionWithParameterContainerAndParameterizationTypeNamed() - { - $parameterContainer = new ParameterContainer; - $expression = new Expression('? > ? AND y < ?', ['x', 5, 10], [Expression::TYPE_IDENTIFIER]); - $sqlAndParams = $this->invokeProcessExpressionMethod($expression, $parameterContainer); - - $parameters = $parameterContainer->getNamedArray(); - - self::assertRegExp('#"x" > :expr\d\d\d\dParam1 AND y < :expr\d\d\d\dParam2#', $sqlAndParams); - - // test keys and values - preg_match('#expr(\d\d\d\d)Param1#', key($parameters), $matches); - $expressionNumber = $matches[1]; - - self::assertRegExp('#expr\d\d\d\dParam1#', key($parameters)); - self::assertEquals(5, current($parameters)); - next($parameters); - self::assertRegExp('#expr\d\d\d\dParam2#', key($parameters)); - self::assertEquals(10, current($parameters)); - - // ensure next invocation increases number by 1 - $parameterContainer = new ParameterContainer; - $sqlAndParamsNext = $this->invokeProcessExpressionMethod($expression, $parameterContainer); - - $parameters = $parameterContainer->getNamedArray(); - - preg_match('#expr(\d\d\d\d)Param1#', key($parameters), $matches); - $expressionNumberNext = $matches[1]; - - self::assertEquals(1, (int) $expressionNumberNext - (int) $expressionNumber); - } - - /** - * @covers \Zend\Db\Sql\AbstractSql::processExpression - */ - public function testProcessExpressionWorksWithExpressionContainingStringParts() - { - $expression = new Predicate\Expression('x = ?', 5); - - $predicateSet = new Predicate\PredicateSet([new Predicate\PredicateSet([$expression])]); - $sqlAndParams = $this->invokeProcessExpressionMethod($predicateSet); - - self::assertEquals("(x = '5')", $sqlAndParams); - } - - /** - * @covers \Zend\Db\Sql\AbstractSql::processExpression - */ - public function testProcessExpressionWorksWithExpressionContainingSelectObject() - { - $select = new Select(); - $select->from('x')->where->like('bar', 'Foo%'); - $expression = new Predicate\In('x', $select); - - $predicateSet = new Predicate\PredicateSet([new Predicate\PredicateSet([$expression])]); - $sqlAndParams = $this->invokeProcessExpressionMethod($predicateSet); - - self::assertEquals('("x" IN (SELECT "x".* FROM "x" WHERE "bar" LIKE \'Foo%\'))', $sqlAndParams); - } - - public function testProcessExpressionWorksWithExpressionContainingExpressionObject() - { - $expression = new Predicate\Operator( - 'release_date', - '=', - new Expression('FROM_UNIXTIME(?)', 100000000) - ); - - $sqlAndParams = $this->invokeProcessExpressionMethod($expression); - self::assertEquals('"release_date" = FROM_UNIXTIME(\'100000000\')', $sqlAndParams); - } - - /** - * @group 7407 - */ - public function testProcessExpressionWorksWithExpressionObjectWithPercentageSigns() - { - $expressionString = 'FROM_UNIXTIME(date, "%Y-%m")'; - $expression = new Expression($expressionString); - $sqlString = $this->invokeProcessExpressionMethod($expression); - - self::assertSame($expressionString, $sqlString); - } - - public function testProcessExpressionWorksWithNamedParameterPrefix() - { - $parameterContainer = new ParameterContainer(); - $namedParameterPrefix = uniqid(); - $expression = new Expression('FROM_UNIXTIME(?)', [10000000]); - $this->invokeProcessExpressionMethod($expression, $parameterContainer, $namedParameterPrefix); - - self::assertSame($namedParameterPrefix . '1', key($parameterContainer->getNamedArray())); - } - - public function testProcessExpressionWorksWithNamedParameterPrefixContainingWhitespace() - { - $parameterContainer = new ParameterContainer(); - $namedParameterPrefix = "string\ncontaining white space"; - $expression = new Expression('FROM_UNIXTIME(?)', [10000000]); - $this->invokeProcessExpressionMethod($expression, $parameterContainer, $namedParameterPrefix); - - self::assertSame('string__containing__white__space1', key($parameterContainer->getNamedArray())); - } - - /** - * @param \Zend\Db\Sql\ExpressionInterface $expression - * @param \Zend\Db\Adapter\ParameterContainer $parameterContainer - * @param string $namedParameterPrefix - * @return \Zend\Db\Adapter\StatementContainer|string - */ - protected function invokeProcessExpressionMethod( - ExpressionInterface $expression, - $parameterContainer = null, - $namedParameterPrefix = null - ) { - $method = new \ReflectionMethod($this->abstractSql, 'processExpression'); - $method->setAccessible(true); - return $method->invoke( - $this->abstractSql, - $expression, - new TrustingSql92Platform, - $this->mockDriver, - $parameterContainer, - $namedParameterPrefix - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/CombineTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/CombineTest.php deleted file mode 100644 index c844dee4..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/CombineTest.php +++ /dev/null @@ -1,213 +0,0 @@ -combine = new Combine; - } - - public function testRejectsInvalidStatement() - { - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - - $this->combine->combine('foo'); - } - - public function testGetSqlString() - { - $this->combine - ->union(new Select('t1')) - ->intersect(new Select('t2')) - ->except(new Select('t3')) - ->union(new Select('t4')); - - self::assertEquals( - // @codingStandardsIgnoreStart - '(SELECT "t1".* FROM "t1") INTERSECT (SELECT "t2".* FROM "t2") EXCEPT (SELECT "t3".* FROM "t3") UNION (SELECT "t4".* FROM "t4")', - // @codingStandardsIgnoreEnd - $this->combine->getSqlString() - ); - } - - public function testGetSqlStringWithModifier() - { - $this->combine - ->union(new Select('t1')) - ->union(new Select('t2'), 'ALL'); - - self::assertEquals( - '(SELECT "t1".* FROM "t1") UNION ALL (SELECT "t2".* FROM "t2")', - $this->combine->getSqlString() - ); - } - - public function testGetSqlStringFromArray() - { - $this->combine->combine([ - [new Select('t1')], - [new Select('t2'), Combine::COMBINE_INTERSECT, 'ALL'], - [new Select('t3'), Combine::COMBINE_EXCEPT], - ]); - - self::assertEquals( - '(SELECT "t1".* FROM "t1") INTERSECT ALL (SELECT "t2".* FROM "t2") EXCEPT (SELECT "t3".* FROM "t3")', - $this->combine->getSqlString() - ); - - $this->combine = new Combine(); - $this->combine->combine([ - new Select('t1'), - new Select('t2'), - new Select('t3'), - ]); - - self::assertEquals( - '(SELECT "t1".* FROM "t1") UNION (SELECT "t2".* FROM "t2") UNION (SELECT "t3".* FROM "t3")', - $this->combine->getSqlString() - ); - } - - public function testGetSqlStringEmpty() - { - self::assertNull($this->combine->getSqlString()); - } - - public function testPrepareStatementWithModifier() - { - $select1 = new Select('t1'); - $select1->where(['x1' => 10]); - $select2 = new Select('t2'); - $select2->where(['x2' => 20]); - - $this->combine->combine([ - $select1, - $select2, - ]); - - $adapter = $this->getMockAdapter(); - - $statement = $this->combine->prepareStatement($adapter, new StatementContainer); - self::assertInstanceOf('Zend\Db\Adapter\StatementContainerInterface', $statement); - self::assertEquals( - '(SELECT "t1".* FROM "t1" WHERE "x1" = ?) UNION (SELECT "t2".* FROM "t2" WHERE "x2" = ?)', - $statement->getSql() - ); - } - - public function testAlignColumns() - { - $select1 = new Select('t1'); - $select1->columns([ - 'c0' => 'c0', - 'c1' => 'c1', - ]); - $select2 = new Select('t2'); - $select2->columns([ - 'c1' => 'c1', - 'c2' => 'c2', - ]); - - $this->combine - ->union([$select1, $select2]) - ->alignColumns(); - - self::assertEquals( - [ - 'c0' => 'c0', - 'c1' => 'c1', - 'c2' => new Expression('NULL'), - ], - $select1->getRawState('columns') - ); - - self::assertEquals( - [ - 'c0' => new Expression('NULL'), - 'c1' => 'c1', - 'c2' => 'c2', - ], - $select2->getRawState('columns') - ); - } - - public function testGetRawState() - { - $select = new Select('t1'); - $this->combine->combine($select); - self::assertSame( - [ - 'combine' => [ - [ - 'select' => $select, - 'type' => Combine::COMBINE_UNION, - 'modifier' => '', - ], - ], - 'columns' => [ - '0' => '*', - ], - ], - $this->combine->getRawState() - ); - } - - /** - * - * @return \PHPUnit_Framework_MockObject_MockObject|\Zend\Db\Adapter\Adapter - */ - protected function getMockAdapter() - { - $parameterContainer = new ParameterContainer(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - - $setGetSqlFunction = function ($sql = null) use ($mockStatement) { - static $sqlValue; - if ($sql) { - $sqlValue = $sql; - return $mockStatement; - } - return $sqlValue; - }; - $mockStatement->expects($this->any())->method('setSql')->will($this->returnCallback($setGetSqlFunction)); - $mockStatement->expects($this->any())->method('getSql')->will($this->returnCallback($setGetSqlFunction)); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - - return $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/AlterTableTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/AlterTableTest.php deleted file mode 100644 index 1bd618b6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/AlterTableTest.php +++ /dev/null @@ -1,122 +0,0 @@ -getRawState('table')); - self::assertSame($at, $at->setTable('test')); - self::assertEquals('test', $at->getRawState('table')); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::addColumn - */ - public function testAddColumn() - { - $at = new AlterTable(); - /** @var \Zend\Db\Sql\Ddl\Column\ColumnInterface $colMock */ - $colMock = $this->getMockBuilder('Zend\Db\Sql\Ddl\Column\ColumnInterface')->getMock(); - self::assertSame($at, $at->addColumn($colMock)); - self::assertEquals([$colMock], $at->getRawState($at::ADD_COLUMNS)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::changeColumn - */ - public function testChangeColumn() - { - $at = new AlterTable(); - /** @var \Zend\Db\Sql\Ddl\Column\ColumnInterface $colMock */ - $colMock = $this->getMockBuilder('Zend\Db\Sql\Ddl\Column\ColumnInterface')->getMock(); - self::assertSame($at, $at->changeColumn('newname', $colMock)); - self::assertEquals(['newname' => $colMock], $at->getRawState($at::CHANGE_COLUMNS)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::dropColumn - */ - public function testDropColumn() - { - $at = new AlterTable(); - self::assertSame($at, $at->dropColumn('foo')); - self::assertEquals(['foo'], $at->getRawState($at::DROP_COLUMNS)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::dropConstraint - */ - public function testDropConstraint() - { - $at = new AlterTable(); - self::assertSame($at, $at->dropConstraint('foo')); - self::assertEquals(['foo'], $at->getRawState($at::DROP_CONSTRAINTS)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::addConstraint - */ - public function testAddConstraint() - { - $at = new AlterTable(); - /** @var \Zend\Db\Sql\Ddl\Constraint\ConstraintInterface $conMock */ - $conMock = $this->getMockBuilder('Zend\Db\Sql\Ddl\Constraint\ConstraintInterface')->getMock(); - self::assertSame($at, $at->addConstraint($conMock)); - self::assertEquals([$conMock], $at->getRawState($at::ADD_CONSTRAINTS)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\AlterTable::getSqlString - * @todo Implement testGetSqlString(). - */ - public function testGetSqlString() - { - $at = new AlterTable('foo'); - $at->addColumn(new Column\Varchar('another', 255)); - $at->changeColumn('name', new Column\Varchar('new_name', 50)); - $at->dropColumn('foo'); - $at->addConstraint(new Constraint\ForeignKey('my_fk', 'other_id', 'other_table', 'id', 'CASCADE', 'CASCADE')); - $at->dropConstraint('my_index'); - $expected = <<getSqlString(); - self::assertEquals( - str_replace(["\r", "\n"], "", $expected), - str_replace(["\r", "\n"], "", $actual) - ); - - $at = new AlterTable(new TableIdentifier('foo')); - $at->addColumn(new Column\Column('bar')); - $this->assertEquals("ALTER TABLE \"foo\"\n ADD COLUMN \"bar\" INTEGER NOT NULL", $at->getSqlString()); - - $at = new AlterTable(new TableIdentifier('bar', 'foo')); - $at->addColumn(new Column\Column('baz')); - $this->assertEquals("ALTER TABLE \"foo\".\"bar\"\n ADD COLUMN \"baz\" INTEGER NOT NULL", $at->getSqlString()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractLengthColumnTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractLengthColumnTest.php deleted file mode 100644 index 4ac3deaf..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractLengthColumnTest.php +++ /dev/null @@ -1,48 +0,0 @@ -getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractLengthColumn', ['foo', 55]); - self::assertEquals(55, $column->getLength()); - self::assertSame($column, $column->setLength(20)); - self::assertEquals(20, $column->getLength()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractLengthColumn::getLength - */ - public function testGetLength() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractLengthColumn', ['foo', 55]); - self::assertEquals(55, $column->getLength()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractLengthColumn::getExpressionData - */ - public function testGetExpressionData() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractLengthColumn', ['foo', 4]); - - self::assertEquals( - [['%s %s NOT NULL', ['foo', 'INTEGER(4)'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractPrecisionColumnTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractPrecisionColumnTest.php deleted file mode 100644 index f81f7c8a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/AbstractPrecisionColumnTest.php +++ /dev/null @@ -1,68 +0,0 @@ -getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn', ['foo', 10]); - self::assertEquals(10, $column->getDigits()); - self::assertSame($column, $column->setDigits(12)); - self::assertEquals(12, $column->getDigits()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn::getDigits - */ - public function testGetDigits() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn', ['foo', 10]); - self::assertEquals(10, $column->getDigits()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn::setDecimal - */ - public function testSetDecimal() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn', ['foo', 10, 5]); - self::assertEquals(5, $column->getDecimal()); - self::assertSame($column, $column->setDecimal(2)); - self::assertEquals(2, $column->getDecimal()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn::getDecimal - */ - public function testGetDecimal() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn', ['foo', 10, 5]); - self::assertEquals(5, $column->getDecimal()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn::getExpressionData - */ - public function testGetExpressionData() - { - $column = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Column\AbstractPrecisionColumn', ['foo', 10, 5]); - - self::assertEquals( - [['%s %s NOT NULL', ['foo', 'INTEGER(10,5)'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BigIntegerTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BigIntegerTest.php deleted file mode 100644 index 2c5db383..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BigIntegerTest.php +++ /dev/null @@ -1,37 +0,0 @@ -getName()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getExpressionData - */ - public function testGetExpressionData() - { - $column = new BigInteger('foo'); - self::assertEquals( - [['%s %s NOT NULL', ['foo', 'BIGINT'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BinaryTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BinaryTest.php deleted file mode 100644 index 33aff543..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BinaryTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BlobTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BlobTest.php deleted file mode 100644 index 724fb92c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BlobTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BooleanTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BooleanTest.php deleted file mode 100644 index f0000d8f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/BooleanTest.php +++ /dev/null @@ -1,44 +0,0 @@ -getExpressionData() - ); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Boolean - * - * @group 6257 - */ - public function testIsAlwaysNotNullable() - { - $column = new Boolean('foo', true); - - self::assertFalse($column->isNullable()); - - $column->setNullable(true); - - self::assertFalse($column->isNullable()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/CharTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/CharTest.php deleted file mode 100644 index e50a8e31..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/CharTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/ColumnTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/ColumnTest.php deleted file mode 100644 index 8ec32bcf..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/ColumnTest.php +++ /dev/null @@ -1,132 +0,0 @@ -setName('foo')); - return $column; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getName - * @depends testSetName - */ - public function testGetName(Column $column) - { - self::assertEquals('foo', $column->getName()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::setNullable - */ - public function testSetNullable() - { - $column = new Column; - self::assertSame($column, $column->setNullable(true)); - return $column; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::isNullable - * @depends testSetNullable - */ - public function testIsNullable(Column $column) - { - self::assertTrue($column->isNullable()); - $column->setNullable(false); - self::assertFalse($column->isNullable()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::setDefault - */ - public function testSetDefault() - { - $column = new Column; - self::assertSame($column, $column->setDefault('foo bar')); - return $column; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getDefault - * @depends testSetDefault - */ - public function testGetDefault(Column $column) - { - self::assertEquals('foo bar', $column->getDefault()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::setOptions - */ - public function testSetOptions() - { - $column = new Column; - self::assertSame($column, $column->setOptions(['autoincrement' => true])); - return $column; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::setOption - */ - public function testSetOption() - { - $column = new Column; - self::assertSame($column, $column->setOption('primary', true)); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getOptions - * @depends testSetOptions - */ - public function testGetOptions(Column $column) - { - self::assertEquals(['autoincrement' => true], $column->getOptions()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getExpressionData - */ - public function testGetExpressionData() - { - $column = new Column; - $column->setName('foo'); - self::assertEquals( - [['%s %s NOT NULL', ['foo', 'INTEGER'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - - $column->setNullable(true); - self::assertEquals( - [['%s %s', ['foo', 'INTEGER'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - - $column->setDefault('bar'); - self::assertEquals( - [[ - '%s %s DEFAULT %s', - ['foo', 'INTEGER', 'bar'], - [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL, $column::TYPE_VALUE], - ]], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DateTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DateTest.php deleted file mode 100644 index 76671afb..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DateTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DatetimeTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DatetimeTest.php deleted file mode 100644 index e75e9502..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DatetimeTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DecimalTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DecimalTest.php deleted file mode 100644 index 2699ee15..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/DecimalTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatTest.php deleted file mode 100644 index 36f06e51..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatTest.php +++ /dev/null @@ -1,29 +0,0 @@ -=')) { - $this->markTestSkipped('Cannot test Float column under PHP 7; reserved keyword'); - } - } - - public function testRaisesDeprecationNoticeOnInstantiation() - { - $this->expectException('PHPUnit_Framework_Error_Deprecated'); - new FloatColumn('foo', 10, 5); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatingTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatingTest.php deleted file mode 100644 index a530ea47..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/FloatingTest.php +++ /dev/null @@ -1,32 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/IntegerTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/IntegerTest.php deleted file mode 100644 index 32729498..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/IntegerTest.php +++ /dev/null @@ -1,49 +0,0 @@ -getName()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Column\Column::getExpressionData - */ - public function testGetExpressionData() - { - $column = new Integer('foo'); - self::assertEquals( - [['%s %s NOT NULL', ['foo', 'INTEGER'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]], - $column->getExpressionData() - ); - - $column = new Integer('foo'); - $column->addConstraint(new PrimaryKey()); - self::assertEquals( - [ - ['%s %s NOT NULL', ['foo', 'INTEGER'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]], - ' ', - ['PRIMARY KEY', [], []], - ], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TextTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TextTest.php deleted file mode 100644 index 613c6f10..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TextTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimeTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimeTest.php deleted file mode 100644 index 91dc56f3..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimeTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimestampTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimestampTest.php deleted file mode 100644 index fc5974b9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/TimestampTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarbinaryTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarbinaryTest.php deleted file mode 100644 index d3189524..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarbinaryTest.php +++ /dev/null @@ -1,28 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarcharTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarcharTest.php deleted file mode 100644 index 701c8106..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Column/VarcharTest.php +++ /dev/null @@ -1,38 +0,0 @@ -getExpressionData() - ); - - $column->setDefault('bar'); - self::assertEquals( - [[ - '%s %s NOT NULL DEFAULT %s', - ['foo', 'VARCHAR(20)', 'bar'], - [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL, $column::TYPE_VALUE], - ]], - $column->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php deleted file mode 100644 index d58dc494..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/AbstractConstraintTest.php +++ /dev/null @@ -1,50 +0,0 @@ -ac = $this->getMockForAbstractClass('Zend\Db\Sql\Ddl\Constraint\AbstractConstraint'); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\AbstractConstraint::setColumns - */ - public function testSetColumns() - { - self::assertSame($this->ac, $this->ac->setColumns(['foo', 'bar'])); - self::assertEquals(['foo', 'bar'], $this->ac->getColumns()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\AbstractConstraint::addColumn - */ - public function testAddColumn() - { - self::assertSame($this->ac, $this->ac->addColumn('foo')); - self::assertEquals(['foo'], $this->ac->getColumns()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\AbstractConstraint::getColumns - */ - public function testGetColumns() - { - $this->ac->setColumns(['foo', 'bar']); - self::assertEquals(['foo', 'bar'], $this->ac->getColumns()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/CheckTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/CheckTest.php deleted file mode 100644 index ed63f115..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/CheckTest.php +++ /dev/null @@ -1,32 +0,0 @@ -0', 'foo'); - self::assertEquals( - [[ - 'CONSTRAINT %s CHECK (%s)', - ['foo', 'id>0'], - [$check::TYPE_IDENTIFIER, $check::TYPE_LITERAL], - ]], - $check->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/ForeignKeyTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/ForeignKeyTest.php deleted file mode 100644 index d4272742..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/ForeignKeyTest.php +++ /dev/null @@ -1,134 +0,0 @@ -setName('xxxx')); - return $fk; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getName - * @depends testSetName - */ - public function testGetName(ForeignKey $fk) - { - self::assertEquals('xxxx', $fk->getName()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::setReferenceTable - */ - public function testSetReferenceTable() - { - $fk = new ForeignKey('foo', 'bar', 'baz', 'bam'); - self::assertSame($fk, $fk->setReferenceTable('xxxx')); - return $fk; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getReferenceTable - * @depends testSetReferenceTable - */ - public function testGetReferenceTable(ForeignKey $fk) - { - self::assertEquals('xxxx', $fk->getReferenceTable()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::setReferenceColumn - */ - public function testSetReferenceColumn() - { - $fk = new ForeignKey('foo', 'bar', 'baz', 'bam'); - self::assertSame($fk, $fk->setReferenceColumn('xxxx')); - return $fk; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getReferenceColumn - * @depends testSetReferenceColumn - */ - public function testGetReferenceColumn(ForeignKey $fk) - { - self::assertEquals(['xxxx'], $fk->getReferenceColumn()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::setOnDeleteRule - */ - public function testSetOnDeleteRule() - { - $fk = new ForeignKey('foo', 'bar', 'baz', 'bam'); - self::assertSame($fk, $fk->setOnDeleteRule('CASCADE')); - return $fk; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getOnDeleteRule - * @depends testSetOnDeleteRule - */ - public function testGetOnDeleteRule(ForeignKey $fk) - { - self::assertEquals('CASCADE', $fk->getOnDeleteRule()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::setOnUpdateRule - */ - public function testSetOnUpdateRule() - { - $fk = new ForeignKey('foo', 'bar', 'baz', 'bam'); - self::assertSame($fk, $fk->setOnUpdateRule('CASCADE')); - return $fk; - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getOnUpdateRule - * @depends testSetOnUpdateRule - */ - public function testGetOnUpdateRule(ForeignKey $fk) - { - self::assertEquals('CASCADE', $fk->getOnUpdateRule()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Constraint\ForeignKey::getExpressionData - */ - public function testGetExpressionData() - { - $fk = new ForeignKey('foo', 'bar', 'baz', 'bam', 'CASCADE', 'SET NULL'); - self::assertEquals( - [[ - 'CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s ON UPDATE %s', - ['foo', 'bar', 'baz', 'bam', 'CASCADE', 'SET NULL'], - [ - $fk::TYPE_IDENTIFIER, - $fk::TYPE_IDENTIFIER, - $fk::TYPE_IDENTIFIER, - $fk::TYPE_IDENTIFIER, - $fk::TYPE_LITERAL, - $fk::TYPE_LITERAL, - ], - ]], - $fk->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/PrimaryKeyTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/PrimaryKeyTest.php deleted file mode 100644 index aef85425..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/PrimaryKeyTest.php +++ /dev/null @@ -1,32 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/UniqueKeyTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/UniqueKeyTest.php deleted file mode 100644 index 3fc8e9b2..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Constraint/UniqueKeyTest.php +++ /dev/null @@ -1,32 +0,0 @@ -getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/CreateTableTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/CreateTableTest.php deleted file mode 100644 index 5c49a3ca..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/CreateTableTest.php +++ /dev/null @@ -1,175 +0,0 @@ -getRawState($ct::TABLE)); - self::assertTrue($ct->isTemporary()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::setTemporary - */ - public function testSetTemporary() - { - $ct = new CreateTable(); - self::assertSame($ct, $ct->setTemporary(false)); - self::assertFalse($ct->isTemporary()); - $ct->setTemporary(true); - self::assertTrue($ct->isTemporary()); - $ct->setTemporary('yes'); - self::assertTrue($ct->isTemporary()); - - self::assertStringStartsWith("CREATE TEMPORARY TABLE", $ct->getSqlString()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::isTemporary - */ - public function testIsTemporary() - { - $ct = new CreateTable(); - self::assertFalse($ct->isTemporary()); - $ct->setTemporary(true); - self::assertTrue($ct->isTemporary()); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::setTable - */ - public function testSetTable() - { - $ct = new CreateTable(); - self::assertEquals('', $ct->getRawState('table')); - $ct->setTable('test'); - return $ct; - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::getRawState - * @depends testSetTable - */ - public function testRawStateViaTable(CreateTable $ct) - { - self::assertEquals('test', $ct->getRawState('table')); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::addColumn - */ - public function testAddColumn() - { - $column = $this->getMockBuilder('Zend\Db\Sql\Ddl\Column\ColumnInterface')->getMock(); - $ct = new CreateTable; - self::assertSame($ct, $ct->addColumn($column)); - return $ct; - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::getRawState - * @depends testAddColumn - */ - public function testRawStateViaColumn(CreateTable $ct) - { - $state = $ct->getRawState('columns'); - self::assertInternalType('array', $state); - $column = array_pop($state); - self::assertInstanceOf('Zend\Db\Sql\Ddl\Column\ColumnInterface', $column); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::addConstraint - */ - public function testAddConstraint() - { - $constraint = $this->getMockBuilder('Zend\Db\Sql\Ddl\Constraint\ConstraintInterface')->getMock(); - $ct = new CreateTable; - self::assertSame($ct, $ct->addConstraint($constraint)); - return $ct; - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::getRawState - * @depends testAddConstraint - */ - public function testRawStateViaConstraint(CreateTable $ct) - { - $state = $ct->getRawState('constraints'); - self::assertInternalType('array', $state); - $constraint = array_pop($state); - self::assertInstanceOf('Zend\Db\Sql\Ddl\Constraint\ConstraintInterface', $constraint); - } - - /** - * @covers \Zend\Db\Sql\Ddl\CreateTable::getSqlString - */ - public function testGetSqlString() - { - $ct = new CreateTable('foo'); - self::assertEquals("CREATE TABLE \"foo\" ( \n)", $ct->getSqlString()); - - $ct = new CreateTable('foo', true); - self::assertEquals("CREATE TEMPORARY TABLE \"foo\" ( \n)", $ct->getSqlString()); - - $ct = new CreateTable('foo'); - $ct->addColumn(new Column('bar')); - self::assertEquals("CREATE TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL \n)", $ct->getSqlString()); - - $ct = new CreateTable('foo', true); - $ct->addColumn(new Column('bar')); - self::assertEquals("CREATE TEMPORARY TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL \n)", $ct->getSqlString()); - - $ct = new CreateTable('foo', true); - $ct->addColumn(new Column('bar')); - $ct->addColumn(new Column('baz')); - self::assertEquals( - "CREATE TEMPORARY TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL,\n \"baz\" INTEGER NOT NULL \n)", - $ct->getSqlString() - ); - - $ct = new CreateTable('foo'); - $ct->addColumn(new Column('bar')); - $ct->addConstraint(new Constraint\PrimaryKey('bat')); - self::assertEquals( - "CREATE TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL , \n PRIMARY KEY (\"bat\") \n)", - $ct->getSqlString() - ); - - $ct = new CreateTable('foo'); - $ct->addConstraint(new Constraint\PrimaryKey('bar')); - $ct->addConstraint(new Constraint\PrimaryKey('bat')); - self::assertEquals( - "CREATE TABLE \"foo\" ( \n PRIMARY KEY (\"bar\"),\n PRIMARY KEY (\"bat\") \n)", - $ct->getSqlString() - ); - - $ct = new CreateTable(new TableIdentifier('foo')); - $ct->addColumn(new Column('bar')); - self::assertEquals("CREATE TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL \n)", $ct->getSqlString()); - - $ct = new CreateTable(new TableIdentifier('bar', 'foo')); - $ct->addColumn(new Column('baz')); - self::assertEquals("CREATE TABLE \"foo\".\"bar\" ( \n \"baz\" INTEGER NOT NULL \n)", $ct->getSqlString()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/DropTableTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/DropTableTest.php deleted file mode 100644 index 91849e37..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/DropTableTest.php +++ /dev/null @@ -1,32 +0,0 @@ -getSqlString()); - - $dt = new DropTable(new TableIdentifier('foo')); - self::assertEquals('DROP TABLE "foo"', $dt->getSqlString()); - - $dt = new DropTable(new TableIdentifier('bar', 'foo')); - self::assertEquals('DROP TABLE "foo"."bar"', $dt->getSqlString()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Index/IndexTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Index/IndexTest.php deleted file mode 100644 index 41eb6c96..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Ddl/Index/IndexTest.php +++ /dev/null @@ -1,64 +0,0 @@ -getExpressionData() - ); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Index\Index::getExpressionData - */ - public function testGetExpressionDataWithLength() - { - $key = new Index(['foo', 'bar'], 'my_uk', [10, 5]); - self::assertEquals( - [[ - 'INDEX %s(%s(10), %s(5))', - ['my_uk', 'foo', 'bar'], - [$key::TYPE_IDENTIFIER, $key::TYPE_IDENTIFIER, $key::TYPE_IDENTIFIER], - ]], - $key->getExpressionData() - ); - } - - /** - * @covers \Zend\Db\Sql\Ddl\Index\Index::getExpressionData - */ - public function testGetExpressionDataWithLengthUnmatched() - { - $key = new Index(['foo', 'bar'], 'my_uk', [10]); - self::assertEquals( - [[ - 'INDEX %s(%s(10), %s)', - ['my_uk', 'foo', 'bar'], - [$key::TYPE_IDENTIFIER, $key::TYPE_IDENTIFIER, $key::TYPE_IDENTIFIER], - ]], - $key->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/DeleteTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/DeleteTest.php deleted file mode 100644 index 51ed727c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/DeleteTest.php +++ /dev/null @@ -1,228 +0,0 @@ -delete = new Delete; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Sql\Delete::from - */ - public function testFrom() - { - $this->delete->from('foo', 'bar'); - self::assertEquals('foo', $this->readAttribute($this->delete, 'table')); - - $tableIdentifier = new TableIdentifier('foo', 'bar'); - $this->delete->from($tableIdentifier); - self::assertEquals($tableIdentifier, $this->readAttribute($this->delete, 'table')); - } - - /** - * @covers \Zend\Db\Sql\Delete::where - * - * @todo REMOVE THIS IN 3.x - */ - public function testWhere() - { - $this->delete->where('x = y'); - $this->delete->where(['foo > ?' => 5]); - $this->delete->where(['id' => 2]); - $this->delete->where(['a = b'], Where::OP_OR); - $this->delete->where(['c1' => null]); - $this->delete->where(['c2' => [1, 2, 3]]); - $this->delete->where([new IsNotNull('c3')]); - $this->delete->where(['one' => 1, 'two' => 2]); - $where = $this->delete->where; - - $predicates = $this->readAttribute($where, 'predicates'); - self::assertEquals('AND', $predicates[0][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - - self::assertEquals('AND', $predicates[1][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Expression', $predicates[1][1]); - - self::assertEquals('AND', $predicates[2][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[2][1]); - - self::assertEquals('OR', $predicates[3][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[3][1]); - - self::assertEquals('AND', $predicates[4][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNull', $predicates[4][1]); - - self::assertEquals('AND', $predicates[5][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\In', $predicates[5][1]); - - self::assertEquals('AND', $predicates[6][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNotNull', $predicates[6][1]); - - self::assertEquals('AND', $predicates[7][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[7][1]); - - self::assertEquals('AND', $predicates[8][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[8][1]); - - $where = new Where; - $this->delete->where($where); - self::assertSame($where, $this->delete->where); - - $this->delete->where(function ($what) use ($where) { - self::assertSame($where, $what); - }); - } - - /** - * @covers \Zend\Db\Sql\Delete::prepareStatement - */ - public function testPrepareStatement() - { - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->at(2)) - ->method('setSql') - ->with($this->equalTo('DELETE FROM "foo" WHERE x = y')); - - $this->delete->from('foo') - ->where('x = y'); - - $this->delete->prepareStatement($mockAdapter, $mockStatement); - - // with TableIdentifier - $this->delete = new Delete; - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->at(2)) - ->method('setSql') - ->with($this->equalTo('DELETE FROM "sch"."foo" WHERE x = y')); - - $this->delete->from(new TableIdentifier('foo', 'sch')) - ->where('x = y'); - - $this->delete->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @covers \Zend\Db\Sql\Delete::getSqlString - */ - public function testGetSqlString() - { - $this->delete->from('foo') - ->where('x = y'); - self::assertEquals('DELETE FROM "foo" WHERE x = y', $this->delete->getSqlString()); - - // with TableIdentifier - $this->delete = new Delete; - $this->delete->from(new TableIdentifier('foo', 'sch')) - ->where('x = y'); - self::assertEquals('DELETE FROM "sch"."foo" WHERE x = y', $this->delete->getSqlString()); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInPrepareStatement() - { - $deleteIgnore = new DeleteIgnore(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->at(2)) - ->method('setSql') - ->with($this->equalTo('DELETE IGNORE FROM "foo" WHERE x = y')); - - $deleteIgnore->from('foo') - ->where('x = y'); - - $deleteIgnore->prepareStatement($mockAdapter, $mockStatement); - - - - // with TableIdentifier - $deleteIgnore = new DeleteIgnore(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->at(2)) - ->method('setSql') - ->with($this->equalTo('DELETE IGNORE FROM "sch"."foo" WHERE x = y')); - - $deleteIgnore->from(new TableIdentifier('foo', 'sch')) - ->where('x = y'); - - $deleteIgnore->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInGetSqlString() - { - $deleteIgnore = new DeleteIgnore(); - - $deleteIgnore->from('foo') - ->where('x = y'); - self::assertEquals('DELETE IGNORE FROM "foo" WHERE x = y', $deleteIgnore->getSqlString()); - - // with TableIdentifier - $deleteIgnore = new DeleteIgnore(); - $deleteIgnore->from(new TableIdentifier('foo', 'sch')) - ->where('x = y'); - self::assertEquals('DELETE IGNORE FROM "sch"."foo" WHERE x = y', $deleteIgnore->getSqlString()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/ExpressionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/ExpressionTest.php deleted file mode 100644 index 25c12d4f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/ExpressionTest.php +++ /dev/null @@ -1,182 +0,0 @@ -setExpression('Foo Bar'); - self::assertSame($expression, $return); - return $return; - } - - /** - * @covers \Zend\Db\Sql\Expression::setExpression - */ - public function testSetExpressionException() - { - $expression = new Expression(); - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Supplied expression must be a string.'); - $expression->setExpression(null); - } - - /** - * @covers \Zend\Db\Sql\Expression::getExpression - * @depends testSetExpression - */ - public function testGetExpression(Expression $expression) - { - self::assertEquals('Foo Bar', $expression->getExpression()); - } - - /** - * @covers \Zend\Db\Sql\Expression::setParameters - */ - public function testSetParameters() - { - $expression = new Expression(); - $return = $expression->setParameters('foo'); - self::assertSame($expression, $return); - return $return; - } - - /** - * @covers \Zend\Db\Sql\Expression::setParameters - */ - public function testSetParametersException() - { - $expression = new Expression('', 'foo'); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Expression parameters must be a scalar or array.'); - $expression->setParameters(null); - } - - /** - * @covers \Zend\Db\Sql\Expression::getParameters - * @depends testSetParameters - */ - public function testGetParameters(Expression $expression) - { - self::assertEquals('foo', $expression->getParameters()); - } - - /** - * @covers \Zend\Db\Sql\Expression::setTypes - */ - public function testSetTypes() - { - $expression = new Expression(); - $return = $expression->setTypes([ - Expression::TYPE_IDENTIFIER, - Expression::TYPE_VALUE, - Expression::TYPE_LITERAL, - ]); - self::assertSame($expression, $return); - return $expression; - } - - /** - * @covers \Zend\Db\Sql\Expression::getTypes - * @depends testSetTypes - */ - public function testGetTypes(Expression $expression) - { - self::assertEquals( - [Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression::TYPE_LITERAL], - $expression->getTypes() - ); - } - - /** - * @covers \Zend\Db\Sql\Expression::getExpressionData - */ - public function testGetExpressionData() - { - $expression = new Expression( - 'X SAME AS ? AND Y = ? BUT LITERALLY ?', - ['foo', 5, 'FUNC(FF%X)'], - [Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression::TYPE_LITERAL] - ); - - self::assertEquals( - [[ - 'X SAME AS %s AND Y = %s BUT LITERALLY %s', - ['foo', 5, 'FUNC(FF%X)'], - [Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression::TYPE_LITERAL], - ]], - $expression->getExpressionData() - ); - $expression = new Expression( - 'X SAME AS ? AND Y = ? BUT LITERALLY ?', - [ - ['foo' => Expression::TYPE_IDENTIFIER], - [5 => Expression::TYPE_VALUE], - ['FUNC(FF%X)' => Expression::TYPE_LITERAL], - ] - ); - - $expected = [[ - 'X SAME AS %s AND Y = %s BUT LITERALLY %s', - ['foo', 5, 'FUNC(FF%X)'], - [Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression::TYPE_LITERAL], - ]]; - - self::assertEquals($expected, $expression->getExpressionData()); - } - - public function testGetExpressionDataWillEscapePercent() - { - $expression = new Expression('X LIKE "foo%"'); - self::assertEquals( - ['X LIKE "foo%%"'], - $expression->getExpressionData() - ); - } - - public function testConstructorWithLiteralZero() - { - $expression = new Expression('0'); - self::assertSame('0', $expression->getExpression()); - } - - /** - * @group 7407 - */ - public function testGetExpressionPreservesPercentageSignInFromUnixtime() - { - $expressionString = 'FROM_UNIXTIME(date, "%Y-%m")'; - $expression = new Expression($expressionString); - - self::assertSame($expressionString, $expression->getExpression()); - } - - public function testNumberOfReplacemensConsidersWhenSameVariableIsUsedManyTimes() - { - $expression = new Expression('uf.user_id = :user_id OR uf.friend_id = :user_id', ['user_id' => 1]); - $expression->getExpressionData(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/InsertTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/InsertTest.php deleted file mode 100644 index e16d4647..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/InsertTest.php +++ /dev/null @@ -1,412 +0,0 @@ -insert = new Insert; - } - - /** - * @covers \Zend\Db\Sql\Insert::into - */ - public function testInto() - { - $this->insert->into('table', 'schema'); - self::assertEquals('table', $this->insert->getRawState('table')); - - $tableIdentifier = new TableIdentifier('table', 'schema'); - $this->insert->into($tableIdentifier); - self::assertEquals($tableIdentifier, $this->insert->getRawState('table')); - } - - /** - * @covers \Zend\Db\Sql\Insert::columns - */ - public function testColumns() - { - $columns = ['foo', 'bar']; - $this->insert->columns($columns); - self::assertEquals($columns, $this->insert->getRawState('columns')); - } - - /** - * @covers \Zend\Db\Sql\Insert::values - */ - public function testValues() - { - $this->insert->values(['foo' => 'bar']); - self::assertEquals(['foo'], $this->insert->getRawState('columns')); - self::assertEquals(['bar'], $this->insert->getRawState('values')); - - // test will merge cols and values of previously set stuff - $this->insert->values(['foo' => 'bax'], Insert::VALUES_MERGE); - $this->insert->values(['boom' => 'bam'], Insert::VALUES_MERGE); - self::assertEquals(['foo', 'boom'], $this->insert->getRawState('columns')); - self::assertEquals(['bax', 'bam'], $this->insert->getRawState('values')); - - $this->insert->values(['foo' => 'bax']); - self::assertEquals(['foo'], $this->insert->getRawState('columns')); - self::assertEquals(['bax'], $this->insert->getRawState('values')); - } - - /** - * @covers \Zend\Db\Sql\Insert::values - */ - public function testValuesThrowsExceptionWhenNotArrayOrSelect() - { - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('values() expects an array of values or Zend\Db\Sql\Select instance'); - $this->insert->values(5); - } - - /** - * @covers \Zend\Db\Sql\Insert::values - */ - public function testValuesThrowsExceptionWhenSelectMergeOverArray() - { - $this->insert->values(['foo' => 'bar']); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('A Zend\Db\Sql\Select instance cannot be provided with the merge flag'); - $this->insert->values(new Select, Insert::VALUES_MERGE); - } - - /** - * @covers \Zend\Db\Sql\Insert::values - */ - public function testValuesThrowsExceptionWhenArrayMergeOverSelect() - { - $this->insert->values(new Select); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'An array of values cannot be provided with the merge flag when a Zend\Db\Sql\Select instance already ' - . 'exists as the value source' - ); - $this->insert->values(['foo' => 'bar'], Insert::VALUES_MERGE); - } - - /** - * @covers \Zend\Db\Sql\Insert::values - * @group ZF2-4926 - */ - public function testEmptyArrayValues() - { - $this->insert->values([]); - self::assertEquals([], $this->readAttribute($this->insert, 'columns')); - } - - /** - * @covers \Zend\Db\Sql\Insert::prepareStatement - */ - public function testPrepareStatement() - { - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('INSERT INTO "foo" ("bar", "boo") VALUES (?, NOW())')); - - $this->insert->into('foo') - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()')]); - - $this->insert->prepareStatement($mockAdapter, $mockStatement); - - // with TableIdentifier - $this->insert = new Insert; - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('INSERT INTO "sch"."foo" ("bar", "boo") VALUES (?, NOW())')); - - $this->insert->into(new TableIdentifier('foo', 'sch')) - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()')]); - - $this->insert->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @covers \Zend\Db\Sql\Insert::prepareStatement - */ - public function testPrepareStatementWithSelect() - { - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = new \Zend\Db\Adapter\StatementContainer(); - - $select = new Select('bar'); - $this->insert - ->into('foo') - ->columns(['col1']) - ->select($select->where(['x' => 5])) - ->prepareStatement($mockAdapter, $mockStatement); - - self::assertEquals( - 'INSERT INTO "foo" ("col1") SELECT "bar".* FROM "bar" WHERE "x" = ?', - $mockStatement->getSql() - ); - $parameters = $mockStatement->getParameterContainer()->getNamedArray(); - self::assertSame(['subselect1where1' => 5], $parameters); - } - - /** - * @covers \Zend\Db\Sql\Insert::getSqlString - */ - public function testGetSqlString() - { - $this->insert->into('foo') - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]); - - self::assertEquals( - 'INSERT INTO "foo" ("bar", "boo", "bam") VALUES (\'baz\', NOW(), NULL)', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - - // with TableIdentifier - $this->insert = new Insert; - $this->insert->into(new TableIdentifier('foo', 'sch')) - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]); - - self::assertEquals( - 'INSERT INTO "sch"."foo" ("bar", "boo", "bam") VALUES (\'baz\', NOW(), NULL)', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - - // with Select - $this->insert = new Insert; - $select = new Select(); - $this->insert->into('foo')->select($select->from('bar')); - - self::assertEquals( - 'INSERT INTO "foo" SELECT "bar".* FROM "bar"', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - - // with Select and columns - $this->insert->columns(['col1', 'col2']); - self::assertEquals( - 'INSERT INTO "foo" ("col1", "col2") SELECT "bar".* FROM "bar"', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - } - - public function testGetSqlStringUsingColumnsAndValuesMethods() - { - // With columns() and values() - $this->insert - ->into('foo') - ->columns(['col1', 'col2', 'col3']) - ->values(['val1', 'val2', 'val3']); - self::assertEquals( - 'INSERT INTO "foo" ("col1", "col2", "col3") VALUES (\'val1\', \'val2\', \'val3\')', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @covers \Zend\Db\Sql\Insert::__set - */ - // @codingStandardsIgnoreStart - public function test__set() - { - // @codingStandardsIgnoreEnd - $this->insert->foo = 'bar'; - self::assertEquals(['foo'], $this->insert->getRawState('columns')); - self::assertEquals(['bar'], $this->insert->getRawState('values')); - } - - /** - * @covers \Zend\Db\Sql\Insert::__unset - */ - // @codingStandardsIgnoreStart - public function test__unset() - { - // @codingStandardsIgnoreEnd - $this->insert->foo = 'bar'; - self::assertEquals(['foo'], $this->insert->getRawState('columns')); - self::assertEquals(['bar'], $this->insert->getRawState('values')); - unset($this->insert->foo); - self::assertEquals([], $this->insert->getRawState('columns')); - self::assertEquals([], $this->insert->getRawState('values')); - - $this->insert->foo = null; - self::assertEquals(['foo'], $this->insert->getRawState('columns')); - self::assertEquals([null], $this->insert->getRawState('values')); - - unset($this->insert->foo); - self::assertEquals([], $this->insert->getRawState('columns')); - self::assertEquals([], $this->insert->getRawState('values')); - } - - /** - * @covers \Zend\Db\Sql\Insert::__isset - */ - // @codingStandardsIgnoreStart - public function test__isset() - { - // @codingStandardsIgnoreEnd - $this->insert->foo = 'bar'; - self::assertTrue(isset($this->insert->foo)); - - $this->insert->foo = null; - self::assertTrue(isset($this->insert->foo)); - } - - /** - * @covers \Zend\Db\Sql\Insert::__get - */ - // @codingStandardsIgnoreStart - public function test__get() - { - // @codingStandardsIgnoreEnd - $this->insert->foo = 'bar'; - self::assertEquals('bar', $this->insert->foo); - - $this->insert->foo = null; - self::assertNull($this->insert->foo); - } - - /** - * @group ZF2-536 - */ - public function testValuesMerge() - { - $this->insert->into('foo') - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]); - $this->insert->into('foo') - ->values(['qux' => 100], Insert::VALUES_MERGE); - - self::assertEquals( - 'INSERT INTO "foo" ("bar", "boo", "bam", "qux") VALUES (\'baz\', NOW(), NULL, \'100\')', - $this->insert->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInPrepareStatement() - { - $replace = new Replace(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('REPLACE INTO "foo" ("bar", "boo") VALUES (?, NOW())')); - - $replace->into('foo') - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()')]); - - $replace->prepareStatement($mockAdapter, $mockStatement); - - // with TableIdentifier - $replace = new Replace(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('REPLACE INTO "sch"."foo" ("bar", "boo") VALUES (?, NOW())')); - - $replace->into(new TableIdentifier('foo', 'sch')) - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()')]); - - $replace->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInGetSqlString() - { - $replace = new Replace(); - $replace->into('foo') - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]); - - self::assertEquals( - 'REPLACE INTO "foo" ("bar", "boo", "bam") VALUES (\'baz\', NOW(), NULL)', - $replace->getSqlString(new TrustingSql92Platform()) - ); - - // with TableIdentifier - $replace = new Replace(); - $replace->into(new TableIdentifier('foo', 'sch')) - ->values(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]); - - self::assertEquals( - 'REPLACE INTO "sch"."foo" ("bar", "boo", "bam") VALUES (\'baz\', NOW(), NULL)', - $replace->getSqlString(new TrustingSql92Platform()) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/JoinTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/JoinTest.php deleted file mode 100644 index 18ca3b0c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/JoinTest.php +++ /dev/null @@ -1,135 +0,0 @@ -next(); - - self::assertAttributeEquals(1, 'position', $join); - } - - public function testRewindResetsPositionToZero() - { - $join = new Join(); - - $join->next(); - $join->next(); - self::assertAttributeEquals(2, 'position', $join); - - $join->rewind(); - self::assertAttributeEquals(0, 'position', $join); - } - - public function testKeyReturnsTheCurrentPosition() - { - $join = new Join(); - - $join->next(); - $join->next(); - $join->next(); - - self::assertEquals(3, $join->key()); - } - - public function testCurrentReturnsTheCurrentJoinSpecification() - { - $name = 'baz'; - $on = 'foo.id = baz.id'; - - $join = new Join(); - $join->join($name, $on); - - $expectedSpecification = [ - 'name' => $name, - 'on' => $on, - 'columns' => [Select::SQL_STAR], - 'type' => Join::JOIN_INNER, - ]; - - self::assertEquals($expectedSpecification, $join->current()); - } - - public function testValidReturnsTrueIfTheIteratorIsAtAValidPositionAndFalseIfNot() - { - $join = new Join(); - $join->join('baz', 'foo.id = baz.id'); - - self::assertTrue($join->valid()); - - $join->next(); - - self::assertFalse($join->valid()); - } - - /** - * @testdox unit test: Test join() returns Join object (is chainable) - * @covers \Zend\Db\Sql\Join::join - */ - public function testJoin() - { - $join = new Join; - $return = $join->join('baz', 'foo.fooId = baz.fooId', Join::JOIN_LEFT); - self::assertSame($join, $return); - } - - public function testJoinWillThrowAnExceptionIfNameIsNoValid() - { - $join = new Join(); - - $this->expectException('\InvalidArgumentException'); - $this->expectExceptionMessage("join() expects '' as a single element associative array"); - $join->join([], false); - } - - /** - * @testdox unit test: Test count() returns correct count - * @covers \Zend\Db\Sql\Join::count - * @covers \Zend\Db\Sql\Join::join - */ - public function testCount() - { - $join = new Join; - $join->join('baz', 'foo.fooId = baz.fooId', Join::JOIN_LEFT); - $join->join('bar', 'foo.fooId = bar.fooId', Join::JOIN_LEFT); - - self::assertEquals(2, $join->count()); - self::assertCount($join->count(), $join->getJoins()); - } - - /** - * @testdox unit test: Test reset() resets the joins - * @covers \Zend\Db\Sql\Join::count - * @covers \Zend\Db\Sql\Join::join - * @covers \Zend\Db\Sql\Join::reset - */ - public function testReset() - { - $join = new Join; - $join->join('baz', 'foo.fooId = baz.fooId', Join::JOIN_LEFT); - $join->join('bar', 'foo.fooId = bar.fooId', Join::JOIN_LEFT); - $join->reset(); - - self::assertEquals(0, $join->count()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/LiteralTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/LiteralTest.php deleted file mode 100644 index d5541cd3..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/LiteralTest.php +++ /dev/null @@ -1,47 +0,0 @@ -setLiteral('foo')); - } - - public function testGetLiteral() - { - $literal = new Literal('bar'); - self::assertEquals('bar', $literal->getLiteral()); - } - - public function testGetExpressionData() - { - $literal = new Literal('bar'); - self::assertEquals([['bar', [], []]], $literal->getExpressionData()); - } - - public function testGetExpressionDataWillEscapePercent() - { - $expression = new Literal('X LIKE "foo%"'); - self::assertEquals( - [[ - 'X LIKE "foo%%"', - [], - [], - ]], - $expression->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/IbmDb2/SelectDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/IbmDb2/SelectDecoratorTest.php deleted file mode 100644 index 1ad37267..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/IbmDb2/SelectDecoratorTest.php +++ /dev/null @@ -1,155 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $driver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - - // test - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([ - $driver, - new IbmDb2Platform(), - ]) - ->getMock(); - - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - $statement->expects($this->once())->method('setSql')->with($expectedPrepareSql); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->setSupportsLimitOffset($supportsLimitOffset); - $selectDecorator->prepareStatement($adapter, $statement); - - self::assertEquals($expectedParams, $parameterContainer->getNamedArray()); - } - - /** - * @testdox integration test: Testing SelectDecorator will use Select to produce properly Ibm DB2 - * dialect sql statements - * @covers \Zend\Db\Sql\Platform\IbmDb2\SelectDecorator::getSqlString - * @dataProvider dataProvider - */ - public function testGetSqlString(Select $select, $ignored0, $ignored1, $expectedSql, $supportsLimitOffset) - { - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->setSupportsLimitOffset($supportsLimitOffset); - - self::assertEquals($expectedSql, @$selectDecorator->getSqlString(new IbmDb2Platform)); - } - - /** - * Data provider for testGetSqlString - * - * @return array - */ - public function dataProvider() - { - $select0 = new Select; - $select0->from(['x' => 'foo'])->limit(5); - $expectedParams0 = [ 'limit' => 5, 'offset' => 0 ]; - // @codingStandardsIgnoreStart - $expectedPrepareSql0 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN ? AND ?'; - $expectedSql0 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN 0 AND 5'; - // @codingStandardsIgnoreEnd - - $select1 = new Select; - $select1->from(['x' => 'foo'])->limit(5)->offset(10); - $expectedParams1 = [ 'limit' => 15, 'offset' => 11 ]; - // @codingStandardsIgnoreStart - $expectedPrepareSql1 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN ? AND ?'; - $expectedSql1 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN 11 AND 15'; - // @codingStandardsIgnoreEnd - - $select2 = new Select; - $select2->columns([new Expression('DISTINCT(id) as id')])->from(['x' => 'foo'])->limit(5)->offset(10); - $expectedParams2 = [ 'limit' => 15, 'offset' => 11]; - // @codingStandardsIgnoreStart - $expectedPrepareSql2 = 'SELECT DISTINCT(id) as id FROM ( SELECT DISTINCT(id) as id, DENSE_RANK() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN ? AND ?'; - $expectedSql2 = 'SELECT DISTINCT(id) as id FROM ( SELECT DISTINCT(id) as id, DENSE_RANK() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN 11 AND 15'; - // @codingStandardsIgnoreEnd - - $select3 = new Select; - $where3 = new Where(); - $where3->greaterThan('x.id', '10')->AND->lessThan('x.id', '31'); - $select3->from(['x' => 'foo'])->where($where3)->limit(5)->offset(10); - $expectedParams3 = [ 'limit' => 15, 'offset' => 11, 'where1' => '10', 'where2' => '31' ]; - // @codingStandardsIgnoreStart - $expectedPrepareSql3 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" WHERE "x"."id" > ? AND "x"."id" < ? ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN ? AND ?'; - $expectedSql3 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" WHERE "x"."id" > \'10\' AND "x"."id" < \'31\' ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN 11 AND 15'; - // @codingStandardsIgnoreEnd - - $select4 = new Select; - $where4 = $where3; - $select4->from(['x' => 'foo'])->where($where4)->limit(5); - $expectedParams4 = [ 'limit' => 5, 'offset' => 0, 'where1' => 10, 'where2' => 31 ]; - // @codingStandardsIgnoreStart - $expectedPrepareSql4 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" WHERE "x"."id" > ? AND "x"."id" < ? ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN ? AND ?'; - $expectedSql4 = 'SELECT * FROM ( SELECT "x".*, ROW_NUMBER() OVER () AS ZEND_DB_ROWNUM FROM "foo" "x" WHERE "x"."id" > \'10\' AND "x"."id" < \'31\' ) AS ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE ZEND_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.ZEND_DB_ROWNUM BETWEEN 0 AND 5'; - // @codingStandardsIgnoreEnd - - $select5 = new Select; - $select5->from(['x' => 'foo'])->limit(5); - $expectedParams5 = []; - $expectedPrepareSql5 = 'SELECT "x".* FROM "foo" "x" LIMIT 5'; - $expectedSql5 = 'SELECT "x".* FROM "foo" "x" LIMIT 5'; - - $select6 = new Select; - $select6->columns([new Expression('DISTINCT(id) as id')])->from(['x' => 'foo'])->limit(5)->offset(10); - $expectedParams6 = []; - $expectedPrepareSql6 = 'SELECT DISTINCT(id) as id FROM "foo" "x" LIMIT 5 OFFSET 10'; - $expectedSql6 = 'SELECT DISTINCT(id) as id FROM "foo" "x" LIMIT 5 OFFSET 10'; - - return [ - [$select0, $expectedPrepareSql0, $expectedParams0, $expectedSql0, false], - [$select1, $expectedPrepareSql1, $expectedParams1, $expectedSql1, false], - [$select2, $expectedPrepareSql2, $expectedParams2, $expectedSql2, false], - [$select3, $expectedPrepareSql3, $expectedParams3, $expectedSql3, false], - [$select4, $expectedPrepareSql4, $expectedParams4, $expectedSql4, false], - [$select5, $expectedPrepareSql5, $expectedParams5, $expectedSql5, true], - [$select6, $expectedPrepareSql6, $expectedParams6, $expectedSql6, true], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/AlterTableDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/AlterTableDecoratorTest.php deleted file mode 100644 index 5be80ff6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/AlterTableDecoratorTest.php +++ /dev/null @@ -1,55 +0,0 @@ -setSubject($ct)); - } - - /** - * @covers Zend\Db\Sql\Platform\Mysql\Ddl\AlterTableDecorator::getSqlString - */ - public function testGetSqlString() - { - $ctd = new AlterTableDecorator(); - $ct = new AlterTable('foo'); - $ctd->setSubject($ct); - - $col = new Column('bar'); - $col->setOption('zerofill', true); - $col->setOption('unsigned', true); - $col->setOption('identity', true); - $col->setOption('comment', 'baz'); - $col->setOption('after', 'bar'); - $col->addConstraint(new PrimaryKey()); - $ct->addColumn($col); - - self::assertEquals( - "ALTER TABLE `foo`\n ADD COLUMN `bar` INTEGER UNSIGNED ZEROFILL " . - "NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'baz' AFTER `bar`", - @$ctd->getSqlString(new Mysql()) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/CreateTableDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/CreateTableDecoratorTest.php deleted file mode 100644 index bfb0bd45..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/Ddl/CreateTableDecoratorTest.php +++ /dev/null @@ -1,57 +0,0 @@ -setSubject($ct)); - } - - /** - * @covers \Zend\Db\Sql\Platform\Mysql\Ddl\CreateTableDecorator::getSqlString - */ - public function testGetSqlString() - { - $ctd = new CreateTableDecorator(); - $ct = new CreateTable('foo'); - $ctd->setSubject($ct); - - $col = new Column('bar'); - $col->setOption('zerofill', true); - $col->setOption('unsigned', true); - $col->setOption('identity', true); - $col->setOption('column-format', 'FIXED'); - $col->setOption('storage', 'memory'); - $col->setOption('comment', 'baz'); - $col->addConstraint(new PrimaryKey()); - $ct->addColumn($col); - - self::assertEquals( - // @codingStandardsIgnoreStart - "CREATE TABLE `foo` ( \n `bar` INTEGER UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'baz' COLUMN_FORMAT FIXED STORAGE MEMORY \n)", - // @codingStandardsIgnoreEnd - @$ctd->getSqlString(new Mysql()) - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/MysqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/MysqlTest.php deleted file mode 100644 index abd7b570..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/MysqlTest.php +++ /dev/null @@ -1,31 +0,0 @@ -getDecorators(); - - $type = key($decorators); - $decorator = current($decorators); - self::assertEquals('Zend\Db\Sql\Select', $type); - self::assertInstanceOf('Zend\Db\Sql\Platform\Mysql\SelectDecorator', $decorator); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/SelectDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/SelectDecoratorTest.php deleted file mode 100644 index abd8eca0..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Mysql/SelectDecoratorTest.php +++ /dev/null @@ -1,249 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $driver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - - // test - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([ - $driver, - new MysqlPlatform(), - ]) - ->getMock(); - - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $statement->expects($this->once())->method('setSql')->with($expectedSql); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->prepareStatement($adapter, $statement); - - self::assertEquals($expectedParams, $parameterContainer->getNamedArray()); - } - - /** - * @testdox integration test: Testing SelectDecorator will use Select an internal state to prepare - * a proper limit/offset sql statement - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::prepareStatement - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::processLimit - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::processOffset - * @dataProvider dataProvider - */ - public function testPrepareStatementForSqlObject( - Select $select, - $ignore, - $expectedParams, - $alsoIgnore, - $expectedPdoSql - ) { - // mock the adapter, driver, and parts - $newStatement = new \Zend\Db\Adapter\Driver\Mysqli\Statement(); - $driver = new \Zend\Db\Adapter\Driver\Pdo\Pdo(new \Zend\Db\Adapter\Driver\Pdo\Connection()); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setConstructorArgs([$driver, new TrustingMysqlPlatform()]) - ->getMock(); - $trustingPlatform = new TrustingMysqlPlatform(); - $mockAdapter->expects($this->any())->method('getPlatform')->will($this->returnValue($trustingPlatform)); - $mockAdapter->expects($this->any())->method('getDriver')->will($this->returnValue($driver)); - // setup mock adapter - $this->mockAdapter = $mockAdapter; - - $this->sql = new Sql($this->mockAdapter, 'foo'); - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $statement = $this->sql->prepareStatementForSqlObject($select, $newStatement); - self::assertEquals($expectedPdoSql, $statement->getSql()); - } - - /** - * @testdox integration test: Testing SelectDecorator will use Select an internal state to prepare - * a proper limit/offset sql statement - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::getSqlString - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::processLimit - * @covers \Zend\Db\Sql\Platform\Mysql\SelectDecorator::processOffset - * @dataProvider dataProvider - */ - public function testGetSqlString(Select $select, $ignore, $alsoIgnore, $expectedSql) - { - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - self::assertEquals($expectedSql, $selectDecorator->getSqlString(new TrustingMysqlPlatform)); - } - - public function dataProvider() - { - $select0 = new Select; - $select0->from('foo')->limit(5)->offset(10); - $expectedPrepareSql0 = 'SELECT `foo`.* FROM `foo` LIMIT ? OFFSET ?'; - $expectedPrepareObjectSql0 = 'SELECT `foo`.* FROM `foo` LIMIT :limit OFFSET :offset'; - $expectedParams0 = ['offset' => 10, 'limit' => 5]; - $expectedSql0 = 'SELECT `foo`.* FROM `foo` LIMIT 5 OFFSET 10'; - - // offset without limit - $select1 = new Select; - $select1->from('foo')->offset(10); - $expectedPrepareSql1 = 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET ?'; - $expectedPrepareObjectSql1 = 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET :offset'; - $expectedParams1 = ['offset' => 10]; - $expectedSql1 = 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET 10'; - - // offset and limit are not type casted when injected into parameter container - $select2 = new Select; - $select2->from('foo')->limit('5')->offset('10000000000000000000'); - $expectedPrepareSql2 = 'SELECT `foo`.* FROM `foo` LIMIT ? OFFSET ?'; - $expectedPrepareObjectSql2 = 'SELECT `foo`.* FROM `foo` LIMIT :limit OFFSET :offset'; - $expectedParams2 = ['offset' => '10000000000000000000', 'limit' => '5']; - $expectedSql2 = 'SELECT `foo`.* FROM `foo` LIMIT 5 OFFSET 10000000000000000000'; - - // nested single limit & offset in field param - $nestedSelect0 = new Select; - $nestedSelect0->from('foo1') - ->columns([ - 'cnt' => new Expression('count(foo1.id)') - ])->limit(100)->offset(500); - - $select3 = new Select; - $select3->from('foo') - ->columns([ - 'res' => $nestedSelect0, - ]) - ->limit(10)->offset(50); - - $expectedPrepareSql3 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` LIMIT ? OFFSET ?) AS `res`" - . " FROM `foo` LIMIT ? OFFSET ?"; - $expectedPrepareObjectSql3 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` LIMIT :subselect1limit OFFSET :subselect1offset) AS `res`" - . " FROM `foo` LIMIT :limit OFFSET :offset"; - $expectedParams3 = [ - 'subselect1limit' => 100, - 'subselect1offset' => 500, - 'limit' => 10, - 'offset' => 50 - ]; - $expectedSql3 = "SELECT (SELECT count(foo1.id) AS `cnt`" - . " FROM `foo1` LIMIT 100 OFFSET 500) AS `res`" - . " FROM `foo` LIMIT 10 OFFSET 50"; - - // nested multiple limit & offset in field param - $nestedSelect0 = new Select; - $nestedSelect0->from('foo1') - ->columns([ - 'cnt' => new Expression('count(foo1.id)') - ])->limit(100)->offset(500); - - $nestedSelect1 = new Select; - $nestedSelect1->from('foo2') - ->columns([ - 'cnt' => new Expression('count(foo2.id)') - ])->limit(50)->offset(101); - - $select4 = new Select; - $select4->from('foo') - ->columns([ - 'res' => $nestedSelect0, - 'res0' => $nestedSelect1 - ]) - ->limit(10)->offset(5); - - $expectedPrepareSql4 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` LIMIT ? OFFSET ?) AS `res`," - . " (SELECT count(foo2.id) AS `cnt` FROM `foo2` LIMIT ? OFFSET ?) AS `res0`" - . " FROM `foo` LIMIT ? OFFSET ?"; - $expectedPrepareObjectSql4 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` LIMIT :subselect1limit OFFSET :subselect1offset)" - . " AS `res`, (SELECT count(foo2.id) AS `cnt` FROM `foo2` LIMIT :subselect2limit OFFSET :subselect2offset)" - . " AS `res0` FROM `foo` LIMIT :limit OFFSET :offset"; - $expectedParams4 = [ - 'subselect1limit' => 100, - 'subselect1offset' => 500, - 'subselect2limit' => 50, - 'subselect2offset' => 101, - 'limit' => 10, - 'offset' => 5 - ]; - $expectedSql4 = "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` LIMIT 100 OFFSET 500) AS `res`," - . " (SELECT count(foo2.id) AS `cnt` FROM `foo2` LIMIT 50 OFFSET 101) AS `res0`" - . " FROM `foo` LIMIT 10 OFFSET 5"; - - // nested limit in field param, no limit in containing select - $nestedSelect0 = new Select; - $nestedSelect0->from('foo1') - ->columns([ - 'cnt' => new Expression('count(foo1.id)') - ]); - $nestedSelect0->where->equalTo('foo2', 'ab'); - $nestedSelect0->limit(1); - - $select5 = new Select; - $select5->from('foo') - ->columns([ - 'res' => $nestedSelect0, - ]); - - $expectedPrepareSql5 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` WHERE `foo2` = ? LIMIT ?) AS `res`" - . " FROM `foo`"; - $expectedPrepareObjectSql5 = - "SELECT (SELECT count(foo1.id) AS `cnt` FROM `foo1` WHERE `foo2` = :subselect1where1 LIMIT" - . " :subselect1limit) AS `res` FROM `foo`"; - $expectedParams5 = [ - 'subselect1limit' => 1, - 'subselect1where1' => 'ab' - ]; - $expectedSql5 = "SELECT (SELECT count(foo1.id) AS `cnt`" - . " FROM `foo1` WHERE `foo2` = 'ab' LIMIT 1) AS `res`" - . " FROM `foo`"; - - - return [ - [$select0, $expectedPrepareSql0, $expectedParams0, $expectedSql0, $expectedPrepareObjectSql0], - [$select1, $expectedPrepareSql1, $expectedParams1, $expectedSql1, $expectedPrepareObjectSql1], - [$select2, $expectedPrepareSql2, $expectedParams2, $expectedSql2, $expectedPrepareObjectSql2], - [$select3, $expectedPrepareSql3, $expectedParams3, $expectedSql3, $expectedPrepareObjectSql3], - [$select4, $expectedPrepareSql4, $expectedParams4, $expectedSql4, $expectedPrepareObjectSql4], - [$select5, $expectedPrepareSql5, $expectedParams5, $expectedSql5, $expectedPrepareObjectSql5], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/OracleTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/OracleTest.php deleted file mode 100644 index 1b1987b2..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/OracleTest.php +++ /dev/null @@ -1,31 +0,0 @@ -getDecorators(); - - $type = key($decorators); - $decorator = current($decorators); - self::assertEquals('Zend\Db\Sql\Select', $type); - self::assertInstanceOf('Zend\Db\Sql\Platform\Oracle\SelectDecorator', $decorator); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/SelectDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/SelectDecoratorTest.php deleted file mode 100644 index 03bb21f5..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Oracle/SelectDecoratorTest.php +++ /dev/null @@ -1,144 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $driver->expects($this->exactly($expectedFormatParamCount)) - ->method('formatParameterName') - ->will($this->returnValue('?')); - - // test - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([ - $driver, - new OraclePlatform(), - ]) - ->getMock(); - - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any()) - ->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $statement->expects($this->once())->method('setSql')->with($expectedSql); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->prepareStatement($adapter, $statement); - - self::assertEquals($expectedParams, $parameterContainer->getNamedArray()); - } - - // @codingStandardsIgnoreStart - /** - * @testdox integration test: Testing SelectDecorator will use Select to produce properly Oracle - * dialect sql statements - * @covers \Zend\Db\Sql\Platform\Oracle\SelectDecorator::getSqlString - * @dataProvider dataProvider - */ - // @codingStandardsIgnoreEnd - public function testGetSqlString(Select $select, $ignored, $alsoIgnored, $expectedSql) - { - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any()) - ->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - self::assertEquals($expectedSql, $selectDecorator->getSqlString(new OraclePlatform)); - } - - /** - * Data provider for testGetSqlString - * - * @return array - */ - public function dataProvider() - { - $select0 = new Select; - $select0->from(['x' => 'foo']); - $expectedSql0 = 'SELECT "x".* FROM "foo" "x"'; - $expectedFormatParamCount0 = 0; - - $select1a = new Select('test'); - $select1b = new Select(['a' => $select1a]); - $select1 = new Select(['b' => $select1b]); - $expectedSql1 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT "test".* FROM "test") "a") "b"'; - $expectedFormatParamCount1 = 0; - - $select2a = new Select('test'); - $select2a->limit(2); - $select2b = new Select(['a' => $select2a]); - $select2 = new Select(['b' => $select2b]); - // @codingStandardsIgnoreStart - $expectedSql2_1 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b WHERE rownum <= (:offset2+:limit2)) WHERE b_rownum >= (:offset2 + 1)) "a") "b"'; - $expectedSql2_2 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b WHERE rownum <= (0+2)) WHERE b_rownum >= (0 + 1)) "a") "b"'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount2 = 0; - $expectedParams2 = ['offset2' => 0, 'limit2' => 2]; - - $select3a = new Select('test'); - $select3a->offset(2); - $select3b = new Select(['a' => $select3a]); - $select3 = new Select(['b' => $select3b]); - // @codingStandardsIgnoreStart - $expectedSql3_1 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b ) WHERE b_rownum > (:offset2)) "a") "b"'; - $expectedSql3_2 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b ) WHERE b_rownum > (2)) "a") "b"'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount3 = 0; - $expectedParams3 = ['offset2' => 2]; - - $select4a = new Select('test'); - $select4a->limit(2); - $select4a->offset(2); - $select4b = new Select(['a' => $select4a]); - $select4 = new Select(['b' => $select4b]); - // @codingStandardsIgnoreStart - $expectedSql4_1 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b WHERE rownum <= (:offset2+:limit2)) WHERE b_rownum >= (:offset2 + 1)) "a") "b"'; - $expectedSql4_2 = 'SELECT "b".* FROM (SELECT "a".* FROM (SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "test".* FROM "test" ) b WHERE rownum <= (2+2)) WHERE b_rownum >= (2 + 1)) "a") "b"'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount4 = 0; - $expectedParams4 = ['offset2' => 2, 'limit2' => 2]; - - return [ - [$select0, $expectedSql0, [], $expectedSql0, $expectedFormatParamCount0], - [$select1, $expectedSql1, [], $expectedSql1, $expectedFormatParamCount1], - [$select2, $expectedSql2_1, $expectedParams2, $expectedSql2_2, $expectedFormatParamCount2], - [$select3, $expectedSql3_1, $expectedParams3, $expectedSql3_2, $expectedFormatParamCount3], - [$select4, $expectedSql4_1, $expectedParams4, $expectedSql4_2, $expectedFormatParamCount4], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/PlatformTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/PlatformTest.php deleted file mode 100644 index 574918ee..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/PlatformTest.php +++ /dev/null @@ -1,126 +0,0 @@ -resolveAdapter('sql92'); - $platform = new Platform($adapter); - - $reflectionMethod = new ReflectionMethod($platform, 'resolvePlatform'); - - $reflectionMethod->setAccessible(true); - - self::assertEquals($adapter->getPlatform(), $reflectionMethod->invoke($platform, null)); - } - - public function testResolvePlatformName() - { - $platform = new Platform($this->resolveAdapter('sql92')); - - $reflectionMethod = new ReflectionMethod($platform, 'resolvePlatformName'); - - $reflectionMethod->setAccessible(true); - - self::assertEquals('mysql', $reflectionMethod->invoke($platform, new TestAsset\TrustingMysqlPlatform())); - self::assertEquals('sqlserver', $reflectionMethod->invoke( - $platform, - new TestAsset\TrustingSqlServerPlatform() - )); - self::assertEquals('oracle', $reflectionMethod->invoke($platform, new TestAsset\TrustingOraclePlatform())); - self::assertEquals('sql92', $reflectionMethod->invoke($platform, new TestAsset\TrustingSql92Platform())); - } - - /** - * @group 6890 - */ - public function testAbstractPlatformCrashesGracefullyOnMissingDefaultPlatform() - { - $adapter = $this->resolveAdapter('sql92'); - $reflectionProperty = new \ReflectionProperty($adapter, 'platform'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($adapter, null); - - $platform = new Platform($adapter); - $reflectionMethod = new ReflectionMethod($platform, 'resolvePlatform'); - - $reflectionMethod->setAccessible(true); - - $this->expectException('Zend\Db\Sql\Exception\RuntimeException'); - $this->expectExceptionMessage('$this->defaultPlatform was not set'); - - $reflectionMethod->invoke($platform, null); - } - - /** - * @group 6890 - */ - public function testAbstractPlatformCrashesGracefullyOnMissingDefaultPlatformWithGetDecorators() - { - $adapter = $this->resolveAdapter('sql92'); - $reflectionProperty = new \ReflectionProperty($adapter, 'platform'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($adapter, null); - - $platform = new Platform($adapter); - $reflectionMethod = new ReflectionMethod($platform, 'resolvePlatform'); - - $reflectionMethod->setAccessible(true); - - $this->expectException('Zend\Db\Sql\Exception\RuntimeException'); - $this->expectExceptionMessage('$this->defaultPlatform was not set'); - - $platform->getDecorators(); - } - - /** - * @param string $platformName - * - * @return Adapter - */ - protected function resolveAdapter($platformName) - { - $platform = null; - - switch ($platformName) { - case 'sql92': - $platform = new TestAsset\TrustingSql92Platform(); - break; - case 'MySql': - $platform = new TestAsset\TrustingMysqlPlatform(); - break; - case 'Oracle': - $platform = new TestAsset\TrustingOraclePlatform(); - break; - case 'SqlServer': - $platform = new TestAsset\TrustingSqlServerPlatform(); - break; - } - - /* @var $mockDriver \Zend\Db\Adapter\Driver\DriverInterface|\PHPUnit_Framework_MockObject_MockObject */ - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnCallback(function () { - return new StatementContainer(); - })); - - return new Adapter($mockDriver, $platform); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/Ddl/CreateTableDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/Ddl/CreateTableDecoratorTest.php deleted file mode 100644 index 00aff16e..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/Ddl/CreateTableDecoratorTest.php +++ /dev/null @@ -1,46 +0,0 @@ -setSubject($ct)->getSqlString()); - - $ct = new CreateTable('foo', true); - self::assertEquals("CREATE TABLE \"#foo\" ( \n)", $ctd->setSubject($ct)->getSqlString()); - - $ct = new CreateTable('foo'); - $ct->addColumn(new Column('bar')); - self::assertEquals( - "CREATE TABLE \"foo\" ( \n \"bar\" INTEGER NOT NULL \n)", - $ctd->setSubject($ct)->getSqlString() - ); - - $ct = new CreateTable('foo', true); - $ct->addColumn(new Column('bar')); - self::assertEquals( - "CREATE TABLE \"#foo\" ( \n \"bar\" INTEGER NOT NULL \n)", - $ctd->setSubject($ct)->getSqlString() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SelectDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SelectDecoratorTest.php deleted file mode 100644 index fc84d661..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SelectDecoratorTest.php +++ /dev/null @@ -1,142 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $driver->expects($this->exactly($expectedFormatParamCount))->method('formatParameterName') - ->will($this->returnValue('?')); - - // test - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([ - $driver, - new SqlServerPlatform(), - ]) - ->getMock(); - - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $statement->expects($this->once())->method('setSql')->with($expectedSql); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->prepareStatement($adapter, $statement); - - self::assertEquals($expectedParams, $parameterContainer->getNamedArray()); - } - - /** - * @testdox integration test: Testing SelectDecorator will use Select an internal state to prepare - * a proper limit/offset sql statement - * @covers \Zend\Db\Sql\Platform\SqlServer\SelectDecorator::getSqlString - * @covers \Zend\Db\Sql\Platform\SqlServer\SelectDecorator::processLimitOffset - * @dataProvider dataProvider - */ - public function testGetSqlString(Select $select, $ignored, $alsoIgnored, $expectedSql) - { - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - self::assertEquals($expectedSql, $selectDecorator->getSqlString(new SqlServerPlatform)); - } - - public function dataProvider() - { - $select0 = new Select; - $select0->from('foo')->columns(['bar', 'baz'])->order('bar')->limit(5)->offset(10); - // @codingStandardsIgnoreStart - $expectedPrepareSql0 = 'SELECT [bar], [baz] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [baz], ROW_NUMBER() OVER (ORDER BY [bar] ASC) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?'; - // @codingStandardsIgnoreEnd - $expectedParams0 = ['offset' => 10, 'limit' => 5, 'offsetForSum' => 10]; - // @codingStandardsIgnoreStart - $expectedSql0 = 'SELECT [bar], [baz] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [baz], ROW_NUMBER() OVER (ORDER BY [bar] ASC) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount0 = 3; - - $select1 = new Select; - $select1->from('foo')->columns(['bar', 'bam' => 'baz'])->limit(5)->offset(10); - // @codingStandardsIgnoreStart - $expectedPrepareSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?'; - // @codingStandardsIgnoreEnd - $expectedParams1 = ['offset' => 10, 'limit' => 5, 'offsetForSum' => 10]; - // @codingStandardsIgnoreStart - $expectedSql1 = 'SELECT [bar], [bam] FROM ( SELECT [foo].[bar] AS [bar], [foo].[baz] AS [bam], ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount1 = 3; - - $select2 = new Select; - $select2->from('foo')->order('bar')->limit(5)->offset(10); - // @codingStandardsIgnoreStart - $expectedPrepareSql2 = 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY [bar] ASC) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?'; - // @codingStandardsIgnoreEnd - $expectedParams2 = ['offset' => 10, 'limit' => 5, 'offsetForSum' => 10]; - // @codingStandardsIgnoreStart - $expectedSql2 = 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY [bar] ASC) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount2 = 3; - - $select3 = new Select; - $select3->from('foo'); - $expectedPrepareSql3 = 'SELECT [foo].* FROM [foo]'; - $expectedParams3 = []; - $expectedSql3 = 'SELECT [foo].* FROM [foo]'; - $expectedFormatParamCount3 = 0; - - $select4 = new Select; - $select4->from('foo')->columns([new Expression('DISTINCT(bar) as bar')])->limit(5)->offset(10); - // @codingStandardsIgnoreStart - $expectedPrepareSql4 = 'SELECT DISTINCT(bar) as bar FROM ( SELECT DISTINCT(bar) as bar, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?'; - // @codingStandardsIgnoreEnd - $expectedParams4 = ['offset' => 10, 'limit' => 5, 'offsetForSum' => 10]; - // @codingStandardsIgnoreStart - $expectedSql4 = 'SELECT DISTINCT(bar) as bar FROM ( SELECT DISTINCT(bar) as bar, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 5+10'; - // @codingStandardsIgnoreEnd - $expectedFormatParamCount4 = 3; - - return [ - [$select0, $expectedPrepareSql0, $expectedParams0, $expectedSql0, $expectedFormatParamCount0], - [$select1, $expectedPrepareSql1, $expectedParams1, $expectedSql1, $expectedFormatParamCount1], - [$select2, $expectedPrepareSql2, $expectedParams2, $expectedSql2, $expectedFormatParamCount2], - [$select3, $expectedPrepareSql3, $expectedParams3, $expectedSql3, $expectedFormatParamCount3], - [$select4, $expectedPrepareSql4, $expectedParams4, $expectedSql4, $expectedFormatParamCount4], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SqlServerTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SqlServerTest.php deleted file mode 100644 index ff86eb7a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/SqlServer/SqlServerTest.php +++ /dev/null @@ -1,31 +0,0 @@ -getDecorators(); - - $type = key($decorators); - $decorator = current($decorators); - self::assertEquals('Zend\Db\Sql\Select', $type); - self::assertInstanceOf('Zend\Db\Sql\Platform\SqlServer\SelectDecorator', $decorator); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SelectDecoratorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SelectDecoratorTest.php deleted file mode 100644 index 94edce2f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SelectDecoratorTest.php +++ /dev/null @@ -1,160 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $driver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - - // test - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([ - $driver, - new SqlitePlatform(), - ]) - ->getMock(); - - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $statement->expects($this->once())->method('setSql')->with($expectedSql); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - $selectDecorator->prepareStatement($adapter, $statement); - - self::assertEquals($expectedParams, $parameterContainer->getNamedArray()); - } - - /** - * @testdox integration test: Testing SelectDecorator will use Select an internal state to prepare a proper combine - * statement - * @covers \Zend\Db\Sql\Platform\Sqlite\SelectDecorator::getSqlString - * @covers \Zend\Db\Sql\Platform\Sqlite\SelectDecorator::processCombine - * @dataProvider dataProviderUnionSyntaxFromCombine - */ - public function testGetSqlStringPreparesUnionSyntaxFromCombine(Select $select, $ignore, $alsoIgnore, $expectedSql) - { - $parameterContainer = new ParameterContainer; - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - - $selectDecorator = new SelectDecorator; - $selectDecorator->setSubject($select); - self::assertEquals($expectedSql, $selectDecorator->getSqlString(new SqlitePlatform)); - } - - /** - * Create a data provider for union syntax that would come from combine - * - * @return mixed[] - */ - public function dataProviderUnionSyntaxFromCombine() - { - $select0 = new Select; - $select0->from('foo'); - $select1 = clone $select0; - $select0->combine($select1); - - $expectedPrepareSql0 = ' SELECT "foo".* FROM "foo" UNION SELECT "foo".* FROM "foo"'; - $expectedParams0 = []; - $expectedSql0 = ' SELECT "foo".* FROM "foo" UNION SELECT "foo".* FROM "foo"'; - - // nested single limit & offset in field param - $nestedSelect0 = new Select; - $nestedSelect0->from('foo1') - ->columns([ - 'cnt' => new Expression('count(foo1.id)') - ])->limit(100)->offset(500); - - $select3 = new Select; - $select3->from('foo') - ->columns([ - 'res' => $nestedSelect0, - ]) - ->limit(10)->offset(50); - - $expectedPrepareSql3 = - ' SELECT ( SELECT count(foo1.id) AS "cnt" FROM "foo1" LIMIT ? OFFSET ?) AS "res"' - . ' FROM "foo" LIMIT ? OFFSET ?'; - $expectedParams3 = [ - 'subselect1limit' => 100, - 'subselect1offset' => 500, - 'limit' => 10, - 'offset' => 50 - ]; - $expectedSql3 = ' SELECT ( SELECT count(foo1.id) AS "cnt"' - . ' FROM "foo1" LIMIT 100 OFFSET 500) AS "res"' - . ' FROM "foo" LIMIT 10 OFFSET 50'; - // multiple nested query - $nestedSelect0 = new Select; - $nestedSelect0->from('foo1') - ->columns([ - 'cnt' => new Expression('count(foo1.id)') - ])->limit(100)->offset(500); - - $nestedSelect1 = new Select; - $nestedSelect1->from('foo2') - ->columns([ - 'cnt' => new Expression('count(foo2.id)') - ])->limit(50)->offset(101); - - $select4 = new Select; - $select4->from('foo') - ->columns([ - 'res' => $nestedSelect0, - 'res0' => $nestedSelect1 - ]) - ->limit(10)->offset(5); - - $expectedPrepareSql4 = - ' SELECT ( SELECT count(foo1.id) AS "cnt" FROM "foo1" LIMIT ? OFFSET ?) AS "res",' - . ' ( SELECT count(foo2.id) AS "cnt" FROM "foo2" LIMIT ? OFFSET ?) AS "res0"' - . ' FROM "foo" LIMIT ? OFFSET ?'; - $expectedParams4 = [ - 'subselect1limit' => 100, - 'subselect1offset' => 500, - 'subselect2limit' => 50, - 'subselect2offset' => 101, - 'limit' => 10, - 'offset' => 5 - ]; - $expectedSql4 = ' SELECT ( SELECT count(foo1.id) AS "cnt" FROM "foo1" LIMIT 100 OFFSET 500) AS "res",' - . ' ( SELECT count(foo2.id) AS "cnt" FROM "foo2" LIMIT 50 OFFSET 101) AS "res0"' - . ' FROM "foo" LIMIT 10 OFFSET 5'; - - return [ - [$select0, $expectedPrepareSql0, $expectedParams0, $expectedSql0], - [$select3, $expectedPrepareSql3, $expectedParams3, $expectedSql3], - [$select4, $expectedPrepareSql4, $expectedParams4, $expectedSql4], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SqliteTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SqliteTest.php deleted file mode 100644 index 4b312f0e..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Platform/Sqlite/SqliteTest.php +++ /dev/null @@ -1,31 +0,0 @@ -getDecorators(); - - $type = key($decorators); - $decorator = current($decorators); - self::assertEquals('Zend\Db\Sql\Select', $type); - self::assertInstanceOf('Zend\Db\Sql\Platform\Sqlite\SelectDecorator', $decorator); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/BetweenTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/BetweenTest.php deleted file mode 100644 index c510bc55..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/BetweenTest.php +++ /dev/null @@ -1,139 +0,0 @@ -between = new Between(); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::__construct - * @covers \Zend\Db\Sql\Predicate\Between::getIdentifier - * @covers \Zend\Db\Sql\Predicate\Between::getMinValue - * @covers \Zend\Db\Sql\Predicate\Between::getMaxValue - */ - public function testConstructorYieldsNullIdentifierMinimumAndMaximumValues() - { - self::assertNull($this->between->getIdentifier()); - self::assertNull($this->between->getMinValue()); - self::assertNull($this->between->getMaxValue()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::__construct - * @covers \Zend\Db\Sql\Predicate\Between::getIdentifier - * @covers \Zend\Db\Sql\Predicate\Between::getMinValue - * @covers \Zend\Db\Sql\Predicate\Between::getMaxValue - */ - public function testConstructorCanPassIdentifierMinimumAndMaximumValues() - { - $between = new Between('foo.bar', 1, 300); - self::assertEquals('foo.bar', $between->getIdentifier()); - self::assertSame(1, $between->getMinValue()); - self::assertSame(300, $between->getMaxValue()); - - $between = new Between('foo.bar', 0, 1); - self::assertEquals('foo.bar', $between->getIdentifier()); - self::assertSame(0, $between->getMinValue()); - self::assertSame(1, $between->getMaxValue()); - - $between = new Between('foo.bar', -1, 0); - self::assertEquals('foo.bar', $between->getIdentifier()); - self::assertSame(-1, $between->getMinValue()); - self::assertSame(0, $between->getMaxValue()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::getSpecification - */ - public function testSpecificationHasSaneDefaultValue() - { - self::assertEquals('%1$s BETWEEN %2$s AND %3$s', $this->between->getSpecification()); - } - - - - /** - * @covers \Zend\Db\Sql\Predicate\Between::setIdentifier - * @covers \Zend\Db\Sql\Predicate\Between::getIdentifier - */ - public function testIdentifierIsMutable() - { - $this->between->setIdentifier('foo.bar'); - self::assertEquals('foo.bar', $this->between->getIdentifier()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::setMinValue - * @covers \Zend\Db\Sql\Predicate\Between::getMinValue - */ - public function testMinValueIsMutable() - { - $this->between->setMinValue(10); - self::assertEquals(10, $this->between->getMinValue()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::setMaxValue - * @covers \Zend\Db\Sql\Predicate\Between::getMaxValue - */ - public function testMaxValueIsMutable() - { - $this->between->setMaxValue(10); - self::assertEquals(10, $this->between->getMaxValue()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::setSpecification - * @covers \Zend\Db\Sql\Predicate\Between::getSpecification - */ - public function testSpecificationIsMutable() - { - $this->between->setSpecification('%1$s IS INBETWEEN %2$s AND %3$s'); - self::assertEquals('%1$s IS INBETWEEN %2$s AND %3$s', $this->between->getSpecification()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\Between::getExpressionData - */ - public function testRetrievingWherePartsReturnsSpecificationArrayOfIdentifierAndValuesAndArrayOfTypes() - { - $this->between->setIdentifier('foo.bar') - ->setMinValue(10) - ->setMaxValue(19); - $expected = [[ - $this->between->getSpecification(), - ['foo.bar', 10, 19], - [Between::TYPE_IDENTIFIER, Between::TYPE_VALUE, Between::TYPE_VALUE], - ]]; - self::assertEquals($expected, $this->between->getExpressionData()); - - $this->between->setIdentifier([10 => Between::TYPE_VALUE]) - ->setMinValue(['foo.bar' => Between::TYPE_IDENTIFIER]) - ->setMaxValue(['foo.baz' => Between::TYPE_IDENTIFIER]); - $expected = [[ - $this->between->getSpecification(), - [10, 'foo.bar', 'foo.baz'], - [Between::TYPE_VALUE, Between::TYPE_IDENTIFIER, Between::TYPE_IDENTIFIER], - ]]; - self::assertEquals($expected, $this->between->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/ExpressionTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/ExpressionTest.php deleted file mode 100644 index 69140a77..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/ExpressionTest.php +++ /dev/null @@ -1,183 +0,0 @@ -getExpression()); - self::assertEmpty($expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassLiteralAndSingleScalarParameterToConstructor() - { - $expression = new Expression('foo.bar = ?', 'bar'); - self::assertEquals('foo.bar = ?', $expression->getExpression()); - self::assertEquals(['bar'], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassNoParameterToConstructor() - { - $expression = new Expression('foo.bar'); - self::assertEquals([], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassSingleNullParameterToConstructor() - { - $expression = new Expression('?', null); - self::assertEquals([null], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassSingleZeroParameterValueToConstructor() - { - $predicate = new Expression('?', 0); - self::assertEquals([0], $predicate->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassSinglePredicateParameterToConstructor() - { - $predicate = new IsNull('foo.baz'); - $expression = new Expression('?', $predicate); - self::assertEquals([$predicate], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassMultiScalarParametersToConstructor() - { - $expression = new Expression('? OR ?', 'foo', 'bar'); - self::assertEquals(['foo', 'bar'], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassMultiNullParametersToConstructor() - { - $expression = new Expression('? OR ?', null, null); - self::assertEquals([null, null], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassMultiPredicateParametersToConstructor() - { - $predicate = new IsNull('foo.baz'); - $expression = new Expression('? OR ?', $predicate, $predicate); - self::assertEquals([$predicate, $predicate], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfOneScalarParameterToConstructor() - { - $expression = new Expression('?', ['foo']); - self::assertEquals(['foo'], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfMultiScalarsParameterToConstructor() - { - $expression = new Expression('? OR ?', ['foo', 'bar']); - self::assertEquals(['foo', 'bar'], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfOneNullParameterToConstructor() - { - $expression = new Expression('?', [null]); - self::assertEquals([null], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfMultiNullsParameterToConstructor() - { - $expression = new Expression('? OR ?', [null, null]); - self::assertEquals([null, null], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfOnePredicateParameterToConstructor() - { - $predicate = new IsNull('foo.baz'); - $expression = new Expression('?', [$predicate]); - self::assertEquals([$predicate], $expression->getParameters()); - } - - /** - * @group 6849 - */ - public function testCanPassArrayOfMultiPredicatesParameterToConstructor() - { - $predicate = new IsNull('foo.baz'); - $expression = new Expression('? OR ?', [$predicate, $predicate]); - self::assertEquals([$predicate, $predicate], $expression->getParameters()); - } - - public function testLiteralIsMutable() - { - $expression = new Expression(); - $expression->setExpression('foo.bar = ?'); - self::assertEquals('foo.bar = ?', $expression->getExpression()); - } - - public function testParameterIsMutable() - { - $expression = new Expression(); - $expression->setParameters(['foo', 'bar']); - self::assertEquals(['foo', 'bar'], $expression->getParameters()); - } - - public function testRetrievingWherePartsReturnsSpecificationArrayOfLiteralAndParametersAndArrayOfTypes() - { - $expression = new Expression(); - $expression->setExpression('foo.bar = ? AND id != ?') - ->setParameters(['foo', 'bar']); - $expected = [[ - 'foo.bar = %s AND id != %s', - ['foo', 'bar'], - [Expression::TYPE_VALUE, Expression::TYPE_VALUE], - ]]; - $test = $expression->getExpressionData(); - self::assertEquals($expected, $test, var_export($test, 1)); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/InTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/InTest.php deleted file mode 100644 index 58b78a7c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/InTest.php +++ /dev/null @@ -1,127 +0,0 @@ -getIdentifier()); - self::assertNull($in->getValueSet()); - } - - public function testCanPassIdentifierAndValueSetToConstructor() - { - $in = new In('foo.bar', [1, 2]); - self::assertEquals('foo.bar', $in->getIdentifier()); - self::assertEquals([1, 2], $in->getValueSet()); - } - - public function testCanPassIdentifierAndEmptyValueSetToConstructor() - { - $in = new In('foo.bar', []); - $this->assertEquals('foo.bar', $in->getIdentifier()); - $this->assertEquals([], $in->getValueSet()); - } - - public function testIdentifierIsMutable() - { - $in = new In(); - $in->setIdentifier('foo.bar'); - self::assertEquals('foo.bar', $in->getIdentifier()); - } - - public function testValueSetIsMutable() - { - $in = new In(); - $in->setValueSet([1, 2]); - self::assertEquals([1, 2], $in->getValueSet()); - } - - public function testRetrievingWherePartsReturnsSpecificationArrayOfIdentifierAndValuesAndArrayOfTypes() - { - $in = new In(); - $in->setIdentifier('foo.bar') - ->setValueSet([1, 2, 3]); - $expected = [[ - '%s IN (%s, %s, %s)', - ['foo.bar', 1, 2, 3], - [In::TYPE_IDENTIFIER, In::TYPE_VALUE, In::TYPE_VALUE, In::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - - $in->setIdentifier('foo.bar') - ->setValueSet([ - [1 => In::TYPE_LITERAL], - [2 => In::TYPE_VALUE], - [3 => In::TYPE_LITERAL], - ]); - $expected = [[ - '%s IN (%s, %s, %s)', - ['foo.bar', 1, 2, 3], - [In::TYPE_IDENTIFIER, In::TYPE_LITERAL, In::TYPE_VALUE, In::TYPE_LITERAL], - ]]; - $qqq = $in->getExpressionData(); - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselect() - { - $select = new Select; - $in = new In('foo', $select); - $expected = [[ - '%s IN %s', - ['foo', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithEmptyValues() - { - $select = new Select; - $in = new In('foo', []); - $expected = [[ - '%s IN ()', - ['foo'], - [$in::TYPE_IDENTIFIER] - ]]; - $this->assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselectAndIdentifier() - { - $select = new Select; - $in = new In('foo', $select); - $expected = [[ - '%s IN %s', - ['foo', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselectAndArrayIdentifier() - { - $select = new Select; - $in = new In(['foo', 'bar'], $select); - $expected = [[ - '(%s, %s) IN %s', - ['foo', 'bar', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/IsNullTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/IsNullTest.php deleted file mode 100644 index 810c6da9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/IsNullTest.php +++ /dev/null @@ -1,61 +0,0 @@ -getIdentifier()); - } - - public function testSpecificationHasSaneDefaultValue() - { - $isNotNull = new IsNotNull(); - self::assertEquals('%1$s IS NOT NULL', $isNotNull->getSpecification()); - } - - public function testCanPassIdentifierToConstructor() - { - $isNotNull = new IsNotNull(); - $isnull = new IsNotNull('foo.bar'); - self::assertEquals('foo.bar', $isnull->getIdentifier()); - } - - public function testIdentifierIsMutable() - { - $isNotNull = new IsNotNull(); - $isNotNull->setIdentifier('foo.bar'); - self::assertEquals('foo.bar', $isNotNull->getIdentifier()); - } - - public function testSpecificationIsMutable() - { - $isNotNull = new IsNotNull(); - $isNotNull->setSpecification('%1$s NOT NULL'); - self::assertEquals('%1$s NOT NULL', $isNotNull->getSpecification()); - } - - public function testRetrievingWherePartsReturnsSpecificationArrayOfIdentifierAndArrayOfTypes() - { - $isNotNull = new IsNotNull(); - $isNotNull->setIdentifier('foo.bar'); - $expected = [[ - $isNotNull->getSpecification(), - ['foo.bar'], - [IsNotNull::TYPE_IDENTIFIER], - ]]; - self::assertEquals($expected, $isNotNull->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LikeTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LikeTest.php deleted file mode 100644 index 9b3f781a..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LikeTest.php +++ /dev/null @@ -1,68 +0,0 @@ -getIdentifier()); - self::assertEquals('', $like->getLike()); - } - - public function testConstructWithArgs() - { - $like = new Like('bar', 'Foo%'); - self::assertEquals('bar', $like->getIdentifier()); - self::assertEquals('Foo%', $like->getLike()); - } - - public function testAccessorsMutators() - { - $like = new Like(); - $like->setIdentifier('bar'); - self::assertEquals('bar', $like->getIdentifier()); - $like->setLike('foo%'); - self::assertEquals('foo%', $like->getLike()); - $like->setSpecification('target = target'); - self::assertEquals('target = target', $like->getSpecification()); - } - - public function testGetExpressionData() - { - $like = new Like('bar', 'Foo%'); - self::assertEquals( - [ - ['%1$s LIKE %2$s', ['bar', 'Foo%'], [$like::TYPE_IDENTIFIER, $like::TYPE_VALUE]], - ], - $like->getExpressionData() - ); - - $like = new Like(['Foo%' => $like::TYPE_VALUE], ['bar' => $like::TYPE_IDENTIFIER]); - self::assertEquals( - [ - ['%1$s LIKE %2$s', ['Foo%', 'bar'], [$like::TYPE_VALUE, $like::TYPE_IDENTIFIER]], - ], - $like->getExpressionData() - ); - } - - public function testInstanceOfPerSetters() - { - $like = new Like(); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $like->setIdentifier('bar')); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $like->setSpecification('%1$s LIKE %2$s')); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $like->setLike('foo%')); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LiteralTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LiteralTest.php deleted file mode 100644 index 955c0a9b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/LiteralTest.php +++ /dev/null @@ -1,34 +0,0 @@ -setLiteral('foo')); - } - - public function testGetLiteral() - { - $literal = new Literal('bar'); - self::assertEquals('bar', $literal->getLiteral()); - } - - public function testGetExpressionData() - { - $literal = new Literal('bar'); - self::assertEquals([['bar', [], []]], $literal->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotBetweenTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotBetweenTest.php deleted file mode 100644 index 241fc71b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotBetweenTest.php +++ /dev/null @@ -1,60 +0,0 @@ -notBetween = new NotBetween(); - } - - /** - * @covers \Zend\Db\Sql\Predicate\NotBetween::getSpecification - */ - public function testSpecificationHasSameDefaultValue() - { - self::assertEquals('%1$s NOT BETWEEN %2$s AND %3$s', $this->notBetween->getSpecification()); - } - - /** - * @covers \Zend\Db\Sql\Predicate\NotBetween::getExpressionData - */ - public function testRetrievingWherePartsReturnsSpecificationArrayOfIdentifierAndValuesAndArrayOfTypes() - { - $this->notBetween->setIdentifier('foo.bar') - ->setMinValue(10) - ->setMaxValue(19); - $expected = [[ - $this->notBetween->getSpecification(), - ['foo.bar', 10, 19], - [NotBetween::TYPE_IDENTIFIER, NotBetween::TYPE_VALUE, NotBetween::TYPE_VALUE], - ]]; - self::assertEquals($expected, $this->notBetween->getExpressionData()); - - $this->notBetween->setIdentifier([10 => NotBetween::TYPE_VALUE]) - ->setMinValue(['foo.bar' => NotBetween::TYPE_IDENTIFIER]) - ->setMaxValue(['foo.baz' => NotBetween::TYPE_IDENTIFIER]); - $expected = [[ - $this->notBetween->getSpecification(), - [10, 'foo.bar', 'foo.baz'], - [NotBetween::TYPE_VALUE, NotBetween::TYPE_IDENTIFIER, NotBetween::TYPE_IDENTIFIER], - ]]; - self::assertEquals($expected, $this->notBetween->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotInTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotInTest.php deleted file mode 100644 index 43f620a1..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotInTest.php +++ /dev/null @@ -1,66 +0,0 @@ -setIdentifier('foo.bar') - ->setValueSet([1, 2, 3]); - $expected = [[ - '%s NOT IN (%s, %s, %s)', - ['foo.bar', 1, 2, 3], - [NotIn::TYPE_IDENTIFIER, NotIn::TYPE_VALUE, NotIn::TYPE_VALUE, NotIn::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselect() - { - $select = new Select; - $in = new NotIn('foo', $select); - $expected = [[ - '%s NOT IN %s', - ['foo', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselectAndIdentifier() - { - $select = new Select; - $in = new NotIn('foo', $select); - $expected = [[ - '%s NOT IN %s', - ['foo', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } - - public function testGetExpressionDataWithSubselectAndArrayIdentifier() - { - $select = new Select; - $in = new NotIn(['foo', 'bar'], $select); - $expected = [[ - '(%s, %s) NOT IN %s', - ['foo', 'bar', $select], - [$in::TYPE_IDENTIFIER, $in::TYPE_IDENTIFIER, $in::TYPE_VALUE], - ]]; - self::assertEquals($expected, $in->getExpressionData()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotLikeTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotLikeTest.php deleted file mode 100644 index 44d4614d..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/NotLikeTest.php +++ /dev/null @@ -1,64 +0,0 @@ -getIdentifier()); - self::assertEquals('', $notLike->getLike()); - } - - public function testConstructWithArgs() - { - $notLike = new NotLike('bar', 'Foo%'); - self::assertEquals('bar', $notLike->getIdentifier()); - self::assertEquals('Foo%', $notLike->getLike()); - } - - public function testAccessorsMutators() - { - $notLike = new NotLike(); - $notLike->setIdentifier('bar'); - self::assertEquals('bar', $notLike->getIdentifier()); - $notLike->setLike('foo%'); - self::assertEquals('foo%', $notLike->getLike()); - $notLike->setSpecification('target = target'); - self::assertEquals('target = target', $notLike->getSpecification()); - } - - public function testGetExpressionData() - { - $notLike = new NotLike('bar', 'Foo%'); - self::assertEquals( - [ - [ - '%1$s NOT LIKE %2$s', - ['bar', 'Foo%'], - [$notLike::TYPE_IDENTIFIER, $notLike::TYPE_VALUE], - ], - ], - $notLike->getExpressionData() - ); - } - - public function testInstanceOfPerSetters() - { - $notLike = new NotLike(); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $notLike->setIdentifier('bar')); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $notLike->setSpecification('%1$s NOT LIKE %2$s')); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Like', $notLike->setLike('foo%')); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/OperatorTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/OperatorTest.php deleted file mode 100644 index 3713e14f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/OperatorTest.php +++ /dev/null @@ -1,103 +0,0 @@ -getLeft()); - self::assertNull($operator->getRight()); - } - - public function testEmptyConstructorYieldsDefaultsForOperatorAndLeftAndRightTypes() - { - $operator = new Operator(); - self::assertEquals(Operator::OP_EQ, $operator->getOperator()); - self::assertEquals(Operator::TYPE_IDENTIFIER, $operator->getLeftType()); - self::assertEquals(Operator::TYPE_VALUE, $operator->getRightType()); - } - - public function testCanPassAllValuesToConstructor() - { - $operator = new Operator('bar', '>=', 'foo.bar', Operator::TYPE_VALUE, Operator::TYPE_IDENTIFIER); - self::assertEquals(Operator::OP_GTE, $operator->getOperator()); - self::assertEquals('bar', $operator->getLeft()); - self::assertEquals('foo.bar', $operator->getRight()); - self::assertEquals(Operator::TYPE_VALUE, $operator->getLeftType()); - self::assertEquals(Operator::TYPE_IDENTIFIER, $operator->getRightType()); - - $operator = new Operator(['bar' => Operator::TYPE_VALUE], '>=', ['foo.bar' => Operator::TYPE_IDENTIFIER]); - self::assertEquals(Operator::OP_GTE, $operator->getOperator()); - self::assertEquals(['bar' => Operator::TYPE_VALUE], $operator->getLeft()); - self::assertEquals(['foo.bar' => Operator::TYPE_IDENTIFIER], $operator->getRight()); - self::assertEquals(Operator::TYPE_VALUE, $operator->getLeftType()); - self::assertEquals(Operator::TYPE_IDENTIFIER, $operator->getRightType()); - - $operator = new Operator('bar', '>=', 0); - self::assertEquals(0, $operator->getRight()); - } - - public function testLeftIsMutable() - { - $operator = new Operator(); - $operator->setLeft('foo.bar'); - self::assertEquals('foo.bar', $operator->getLeft()); - } - - public function testRightIsMutable() - { - $operator = new Operator(); - $operator->setRight('bar'); - self::assertEquals('bar', $operator->getRight()); - } - - public function testLeftTypeIsMutable() - { - $operator = new Operator(); - $operator->setLeftType(Operator::TYPE_VALUE); - self::assertEquals(Operator::TYPE_VALUE, $operator->getLeftType()); - } - - public function testRightTypeIsMutable() - { - $operator = new Operator(); - $operator->setRightType(Operator::TYPE_IDENTIFIER); - self::assertEquals(Operator::TYPE_IDENTIFIER, $operator->getRightType()); - } - - public function testOperatorIsMutable() - { - $operator = new Operator(); - $operator->setOperator(Operator::OP_LTE); - self::assertEquals(Operator::OP_LTE, $operator->getOperator()); - } - - public function testRetrievingWherePartsReturnsSpecificationArrayOfLeftAndRightAndArrayOfTypes() - { - $operator = new Operator(); - $operator->setLeft('foo') - ->setOperator('>=') - ->setRight('foo.bar') - ->setLeftType(Operator::TYPE_VALUE) - ->setRightType(Operator::TYPE_IDENTIFIER); - $expected = [[ - '%s >= %s', - ['foo', 'foo.bar'], - [Operator::TYPE_VALUE, Operator::TYPE_IDENTIFIER], - ]]; - $test = $operator->getExpressionData(); - self::assertEquals($expected, $test, var_export($test, 1)); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateSetTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateSetTest.php deleted file mode 100644 index 08a73d8b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateSetTest.php +++ /dev/null @@ -1,133 +0,0 @@ -addPredicate(new IsNull('foo')) - ->addPredicate(new IsNull('bar')); - $parts = $predicateSet->getExpressionData(); - self::assertCount(3, $parts); - self::assertContains('AND', $parts[1]); - self::assertNotContains('OR', $parts[1]); - } - - public function testCanPassPredicatesAndDefaultCombinationViaConstructor() - { - $predicateSet = new PredicateSet(); - $set = new PredicateSet([ - new IsNull('foo'), - new IsNull('bar'), - ], 'OR'); - $parts = $set->getExpressionData(); - self::assertCount(3, $parts); - self::assertContains('OR', $parts[1]); - self::assertNotContains('AND', $parts[1]); - } - - public function testCanPassBothPredicateAndCombinationToAddPredicate() - { - $predicateSet = new PredicateSet(); - $predicateSet->addPredicate(new IsNull('foo'), 'OR') - ->addPredicate(new IsNull('bar'), 'AND') - ->addPredicate(new IsNull('baz'), 'OR') - ->addPredicate(new IsNull('bat'), 'AND'); - $parts = $predicateSet->getExpressionData(); - self::assertCount(7, $parts); - - self::assertNotContains('OR', $parts[1], var_export($parts, 1)); - self::assertContains('AND', $parts[1]); - - self::assertContains('OR', $parts[3]); - self::assertNotContains('AND', $parts[3]); - - self::assertNotContains('OR', $parts[5]); - self::assertContains('AND', $parts[5]); - } - - public function testCanUseOrPredicateAndAndPredicateMethods() - { - $predicateSet = new PredicateSet(); - $predicateSet->orPredicate(new IsNull('foo')) - ->andPredicate(new IsNull('bar')) - ->orPredicate(new IsNull('baz')) - ->andPredicate(new IsNull('bat')); - $parts = $predicateSet->getExpressionData(); - self::assertCount(7, $parts); - - self::assertNotContains('OR', $parts[1], var_export($parts, 1)); - self::assertContains('AND', $parts[1]); - - self::assertContains('OR', $parts[3]); - self::assertNotContains('AND', $parts[3]); - - self::assertNotContains('OR', $parts[5]); - self::assertContains('AND', $parts[5]); - } - - /** - * @covers \Zend\Db\Sql\Predicate\PredicateSet::addPredicates - */ - public function testAddPredicates() - { - $predicateSet = new PredicateSet(); - - $predicateSet->addPredicates('x = y'); - $predicateSet->addPredicates(['foo > ?' => 5]); - $predicateSet->addPredicates(['id' => 2]); - $predicateSet->addPredicates(['a = b'], PredicateSet::OP_OR); - $predicateSet->addPredicates(['c1' => null]); - $predicateSet->addPredicates(['c2' => [1, 2, 3]]); - $predicateSet->addPredicates([new \Zend\Db\Sql\Predicate\IsNotNull('c3')]); - - $predicates = $this->readAttribute($predicateSet, 'predicates'); - self::assertEquals('AND', $predicates[0][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - - self::assertEquals('AND', $predicates[1][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Expression', $predicates[1][1]); - - self::assertEquals('AND', $predicates[2][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[2][1]); - - self::assertEquals('OR', $predicates[3][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[3][1]); - - self::assertEquals('AND', $predicates[4][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNull', $predicates[4][1]); - - self::assertEquals('AND', $predicates[5][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\In', $predicates[5][1]); - - self::assertEquals('AND', $predicates[6][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNotNull', $predicates[6][1]); - - $predicateSet->addPredicates(function ($what) use ($predicateSet) { - self::assertSame($predicateSet, $what); - }); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Predicate cannot be null'); - $predicateSet->addPredicates(null); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateTest.php deleted file mode 100644 index a81f0afa..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/Predicate/PredicateTest.php +++ /dev/null @@ -1,287 +0,0 @@ -equalTo('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s = %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - public function testNotEqualToCreatesOperatorPredicate() - { - $predicate = new Predicate(); - $predicate->notEqualTo('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s != %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - - public function testLessThanCreatesOperatorPredicate() - { - $predicate = new Predicate(); - $predicate->lessThan('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s < %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - public function testGreaterThanCreatesOperatorPredicate() - { - $predicate = new Predicate(); - $predicate->greaterThan('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s > %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - public function testLessThanOrEqualToCreatesOperatorPredicate() - { - $predicate = new Predicate(); - $predicate->lessThanOrEqualTo('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s <= %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - public function testGreaterThanOrEqualToCreatesOperatorPredicate() - { - $predicate = new Predicate(); - $predicate->greaterThanOrEqualTo('foo.bar', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s >= %s', $parts[0]); - self::assertContains(['foo.bar', 'bar'], $parts[0]); - } - - public function testLikeCreatesLikePredicate() - { - $predicate = new Predicate(); - $predicate->like('foo.bar', 'bar%'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s LIKE %2$s', $parts[0]); - self::assertContains(['foo.bar', 'bar%'], $parts[0]); - } - - public function testNotLikeCreatesLikePredicate() - { - $predicate = new Predicate(); - $predicate->notLike('foo.bar', 'bar%'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s NOT LIKE %2$s', $parts[0]); - self::assertContains(['foo.bar', 'bar%'], $parts[0]); - } - - public function testLiteralCreatesLiteralPredicate() - { - $predicate = new Predicate(); - $predicate->literal('foo.bar = ?', 'bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('foo.bar = %s', $parts[0]); - self::assertContains(['bar'], $parts[0]); - } - - public function testIsNullCreatesIsNullPredicate() - { - $predicate = new Predicate(); - $predicate->isNull('foo.bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s IS NULL', $parts[0]); - self::assertContains(['foo.bar'], $parts[0]); - } - - public function testIsNotNullCreatesIsNotNullPredicate() - { - $predicate = new Predicate(); - $predicate->isNotNull('foo.bar'); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s IS NOT NULL', $parts[0]); - self::assertContains(['foo.bar'], $parts[0]); - } - - public function testInCreatesInPredicate() - { - $predicate = new Predicate(); - $predicate->in('foo.bar', ['foo', 'bar']); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s IN (%s, %s)', $parts[0]); - self::assertContains(['foo.bar', 'foo', 'bar'], $parts[0]); - } - - public function testNotInCreatesNotInPredicate() - { - $predicate = new Predicate(); - $predicate->notIn('foo.bar', ['foo', 'bar']); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%s NOT IN (%s, %s)', $parts[0]); - self::assertContains(['foo.bar', 'foo', 'bar'], $parts[0]); - } - - public function testBetweenCreatesBetweenPredicate() - { - $predicate = new Predicate(); - $predicate->between('foo.bar', 1, 10); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s BETWEEN %2$s AND %3$s', $parts[0]); - self::assertContains(['foo.bar', 1, 10], $parts[0]); - } - - public function testBetweenCreatesNotBetweenPredicate() - { - $predicate = new Predicate(); - $predicate->notBetween('foo.bar', 1, 10); - $parts = $predicate->getExpressionData(); - self::assertCount(1, $parts); - self::assertContains('%1$s NOT BETWEEN %2$s AND %3$s', $parts[0]); - self::assertContains(['foo.bar', 1, 10], $parts[0]); - } - - public function testCanChainPredicateFactoriesBetweenOperators() - { - $predicate = new Predicate(); - $predicate->isNull('foo.bar') - ->or - ->isNotNull('bar.baz') - ->and - ->equalTo('baz.bat', 'foo'); - $parts = $predicate->getExpressionData(); - self::assertCount(5, $parts); - - self::assertContains('%1$s IS NULL', $parts[0]); - self::assertContains(['foo.bar'], $parts[0]); - - self::assertEquals(' OR ', $parts[1]); - - self::assertContains('%1$s IS NOT NULL', $parts[2]); - self::assertContains(['bar.baz'], $parts[2]); - - self::assertEquals(' AND ', $parts[3]); - - self::assertContains('%s = %s', $parts[4]); - self::assertContains(['baz.bat', 'foo'], $parts[4]); - } - - public function testCanNestPredicates() - { - $predicate = new Predicate(); - $predicate->isNull('foo.bar') - ->nest() - ->isNotNull('bar.baz') - ->and - ->equalTo('baz.bat', 'foo') - ->unnest(); - $parts = $predicate->getExpressionData(); - - self::assertCount(7, $parts); - - self::assertContains('%1$s IS NULL', $parts[0]); - self::assertContains(['foo.bar'], $parts[0]); - - self::assertEquals(' AND ', $parts[1]); - - self::assertEquals('(', $parts[2]); - - self::assertContains('%1$s IS NOT NULL', $parts[3]); - self::assertContains(['bar.baz'], $parts[3]); - - self::assertEquals(' AND ', $parts[4]); - - self::assertContains('%s = %s', $parts[5]); - self::assertContains(['baz.bat', 'foo'], $parts[5]); - - self::assertEquals(')', $parts[6]); - } - - /** - * @testdox Unit test: Test expression() is chainable and returns proper values - */ - public function testExpression() - { - $predicate = new Predicate; - - // is chainable - self::assertSame($predicate, $predicate->expression('foo = ?', 0)); - // with parameter - self::assertEquals( - [['foo = %s', [0], [Expression::TYPE_VALUE]]], - $predicate->getExpressionData() - ); - } - - /** - * @testdox Unit test: Test expression() allows null $parameters - */ - public function testExpressionNullParameters() - { - $predicate = new Predicate; - - $predicate->expression('foo = bar'); - $predicates = $predicate->getPredicates(); - $expression = $predicates[0][1]; - self::assertEquals([null], $expression->getParameters()); - } - - /** - * @testdox Unit test: Test literal() is chainable, returns proper values, and is backwards compatible with 2.0.* - */ - public function testLiteral() - { - $predicate = new Predicate; - - // is chainable - self::assertSame($predicate, $predicate->literal('foo = bar')); - // with parameter - self::assertEquals( - [['foo = bar', [], []]], - $predicate->getExpressionData() - ); - - // test literal() is backwards-compatible, and works with with parameters - $predicate = new Predicate; - $predicate->expression('foo = ?', 'bar'); - // with parameter - self::assertEquals( - [['foo = %s', ['bar'], [Expression::TYPE_VALUE]]], - $predicate->getExpressionData() - ); - - // test literal() is backwards-compatible, and works with with parameters, even 0 which tests as false - $predicate = new Predicate; - $predicate->expression('foo = ?', 0); - // with parameter - self::assertEquals( - [['foo = %s', [0], [Expression::TYPE_VALUE]]], - $predicate->getExpressionData() - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/SelectTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/SelectTest.php deleted file mode 100644 index 0054b429..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/SelectTest.php +++ /dev/null @@ -1,1490 +0,0 @@ -getRawState('table')); - } - - /** - * @testdox unit test: Test from() returns Select object (is chainable) - * @covers \Zend\Db\Sql\Select::from - */ - public function testFrom() - { - $select = new Select; - $return = $select->from('foo', 'bar'); - self::assertSame($select, $return); - - return $return; - } - - /** - * @testdox unit test: Test getRawState() returns information populated via from() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testFrom - */ - public function testGetRawStateViaFrom(Select $select) - { - self::assertEquals('foo', $select->getRawState('table')); - } - - /** - * @testdox unit test: Test quantifier() returns Select object (is chainable) - * @covers \Zend\Db\Sql\Select::quantifier - */ - public function testQuantifier() - { - $select = new Select; - $return = $select->quantifier($select::QUANTIFIER_DISTINCT); - self::assertSame($select, $return); - return $return; - } - - /** - * @testdox unit test: Test getRawState() returns information populated via quantifier() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testQuantifier - */ - public function testGetRawStateViaQuantifier(Select $select) - { - self::assertEquals(Select::QUANTIFIER_DISTINCT, $select->getRawState('quantifier')); - } - - /** - * @testdox unit test: Test quantifier() accepts expression - * @covers \Zend\Db\Sql\Select::quantifier - */ - public function testQuantifierParameterExpressionInterface() - { - $expr = $this->getMockBuilder('Zend\Db\Sql\ExpressionInterface')->getMock(); - $select = new Select; - $select->quantifier($expr); - self::assertSame( - $expr, - $select->getRawState(Select::QUANTIFIER) - ); - } - - /** - * @testdox unit test: Test columns() returns Select object (is chainable) - * @covers \Zend\Db\Sql\Select::columns - */ - public function testColumns() - { - $select = new Select; - $return = $select->columns(['foo', 'bar']); - self::assertSame($select, $return); - - return $select; - } - - /** - * @testdox unit test: Test isTableReadOnly() returns correct state for read only - * @covers \Zend\Db\Sql\Select::isTableReadOnly - */ - public function testIsTableReadOnly() - { - $select = new Select('foo'); - self::assertTrue($select->isTableReadOnly()); - - $select = new Select; - self::assertFalse($select->isTableReadOnly()); - } - - /** - * @testdox unit test: Test getRawState() returns information populated via columns() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testColumns - */ - public function testGetRawStateViaColumns(Select $select) - { - self::assertEquals(['foo', 'bar'], $select->getRawState('columns')); - } - - /** - * @testdox unit test: Test join() returns same Select object (is chainable) - * @covers \Zend\Db\Sql\Select::join - */ - public function testJoin() - { - $select = new Select; - $return = $select->join('foo', 'x = y', Select::SQL_STAR, Select::JOIN_INNER); - self::assertSame($select, $return); - - return $return; - } - - /** - * @testdox unit test: Test join() exception with bad join - * @covers \Zend\Db\Sql\Select::join - */ - public function testBadJoin() - { - $select = new Select; - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage("expects 'foo' as"); - $select->join(['foo'], 'x = y', Select::SQL_STAR, Select::JOIN_INNER); - } - - /** - * @testdox unit test: Test processJoins() exception with bad join name - * @covers \Zend\Db\Sql\Select::processJoins - */ - public function testBadJoinName() - { - $mockExpression = $this->getMockBuilder('Zend\Db\Sql\ExpressionInterface') - ->setConstructorArgs(['bar']) - ->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $parameterContainer = new ParameterContainer(); - - $select = new Select; - $select->join(['foo' => $mockExpression], 'x = y', Select::SQL_STAR, Select::JOIN_INNER); - - $sr = new ReflectionObject($select); - - $mr = $sr->getMethod('processJoins'); - - $mr->setAccessible(true); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - - $mr->invokeArgs($select, [new Sql92, $mockDriver, $parameterContainer]); - } - - /** - * @testdox unit test: Test getRawState() returns information populated via join() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testJoin - */ - public function testGetRawStateViaJoin(Select $select) - { - self::assertEquals( - [[ - 'name' => 'foo', - 'on' => 'x = y', - 'columns' => [Select::SQL_STAR], - 'type' => Select::JOIN_INNER, - ]], - $select->getRawState('joins')->getJoins() - ); - } - - /** - * @testdox unit test: Test where() returns Select object (is chainable) - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereReturnsSameSelectObject() - { - $select = new Select; - self::assertSame($select, $select->where('x = y')); - } - - /** - * @testdox unit test: Test where() will accept a string for the predicate to create an expression predicate - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsString() - { - $select = new Select; - $select->where('x = ?'); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertCount(1, $predicates); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Expression', $predicates[0][1]); - self::assertEquals(Where::OP_AND, $predicates[0][0]); - self::assertEquals('x = ?', $predicates[0][1]->getExpression()); - - $select = new Select; - $select->where('x = y'); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - } - - /** - * @testdox unit test: Test where() will accept an array with a string key (containing ?) used as an - * expression with placeholder - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsAssociativeArrayContainingReplacementCharacter() - { - $select = new Select; - $select->where(['foo > ?' => 5]); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertCount(1, $predicates); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Expression', $predicates[0][1]); - self::assertEquals(Where::OP_AND, $predicates[0][0]); - self::assertEquals('foo > ?', $predicates[0][1]->getExpression()); - self::assertEquals([5], $predicates[0][1]->getParameters()); - } - - /** - * @testdox unit test: Test where() will accept any array with string key (without ?) to be used - * as Operator predicate - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsAssociativeArrayNotContainingReplacementCharacter() - { - $select = new Select; - $select->where(['name' => 'Ralph', 'age' => 33]); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertCount(2, $predicates); - - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[0][1]); - self::assertEquals(Where::OP_AND, $predicates[0][0]); - self::assertEquals('name', $predicates[0][1]->getLeft()); - self::assertEquals('Ralph', $predicates[0][1]->getRight()); - - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[1][1]); - self::assertEquals(Where::OP_AND, $predicates[1][0]); - self::assertEquals('age', $predicates[1][1]->getLeft()); - self::assertEquals(33, $predicates[1][1]->getRight()); - - $select = new Select; - $select->where(['x = y']); - - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - } - - /** - * @testdox unit test: Test where() will accept any array with string key (without ?) with Predicate throw Exception - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsAssociativeArrayIsPredicate() - { - $select = new Select; - $where = [ - 'name' => new Predicate\Literal("name = 'Ralph'"), - 'age' => new Predicate\Expression('age = ?', 33), - ]; - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Using Predicate must not use string keys'); - $select->where($where); - } - - /** - * @testdox unit test: Test where() will accept an indexed array to be used by joining string expressions - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsIndexedArray() - { - $select = new Select; - $select->where(['name = "Ralph"']); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertCount(1, $predicates); - - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - self::assertEquals(Where::OP_AND, $predicates[0][0]); - self::assertEquals('name = "Ralph"', $predicates[0][1]->getLiteral()); - } - - /** - * @testdox unit test: Test where() will accept an indexed array to be used by joining string expressions, - * combined by OR - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsIndexedArrayArgument2IsOr() - { - $select = new Select; - $select->where(['name = "Ralph"'], Where::OP_OR); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertCount(1, $predicates); - - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - self::assertEquals(Where::OP_OR, $predicates[0][0]); - self::assertEquals('name = "Ralph"', $predicates[0][1]->getLiteral()); - } - - /** - * @testdox unit test: Test where() will accept a closure to be executed with Where object as argument - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsClosure() - { - $select = new Select; - $where = $select->getRawState('where'); - - $select->where(function ($what) use ($where) { - self::assertSame($where, $what); - }); - } - - /** - * @testdox unit test: Test where() will accept any Predicate object as-is - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsPredicate() - { - $select = new Select; - $predicate = new Predicate\Predicate([ - new Predicate\Expression('name = ?', 'Ralph'), - new Predicate\Expression('age = ?', 33), - ]); - $select->where($predicate); - - /** @var $where Where */ - $where = $select->getRawState('where'); - $predicates = $where->getPredicates(); - self::assertSame($predicate, $predicates[0][1]); - } - - /** - * @testdox unit test: Test where() will accept a Where object - * @covers \Zend\Db\Sql\Select::where - */ - public function testWhereArgument1IsWhereObject() - { - $select = new Select; - $select->where($newWhere = new Where); - self::assertSame($newWhere, $select->getRawState('where')); - } - - /** - * @author Rob Allen - * @testdox unit test: Test order() - * @covers \Zend\Db\Sql\Select::order - */ - public function testOrder() - { - $select = new Select; - $return = $select->order('id DESC'); - self::assertSame($select, $return); // test fluent interface - self::assertEquals(['id DESC'], $select->getRawState('order')); - - $select = new Select; - $select->order('id DESC') - ->order('name ASC, age DESC'); - self::assertEquals(['id DESC', 'name ASC', 'age DESC'], $select->getRawState('order')); - - $select = new Select; - $select->order(['name ASC', 'age DESC']); - self::assertEquals(['name ASC', 'age DESC'], $select->getRawState('order')); - - $select = new Select; - $select->order(new Expression('RAND()')); - $sr = new ReflectionObject($select); - $method = $sr->getMethod('processOrder'); - $method->setAccessible(true); - self::assertEquals( - [[['RAND()']]], - $method->invokeArgs($select, [new TrustingSql92Platform()]) - ); - - $select = new Select; - $select->order( - $this->getMockBuilder('Zend\Db\Sql\Predicate\Operator') - ->setMethods() - ->setConstructorArgs(['rating', '<', '10']) - ->getMock() - ); - $sr = new ReflectionObject($select); - $method = $sr->getMethod('processOrder'); - $method->setAccessible(true); - self::assertEquals( - [[['"rating" < \'10\'']]], - $method->invokeArgs($select, [new TrustingSql92Platform()]) - ); - } - - /** - * @testdox unit test: Test order() correctly splits parameters. - * @covers \Zend\Db\Sql\Select::order - */ - public function testOrderCorrectlySplitsParameter() - { - $select = new Select; - $select->order('name desc'); - self::assertEquals( - 'SELECT * ORDER BY "name" DESC', - $select->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @testdox: unit test: test limit() - * @covers \Zend\Db\Sql\Select::limit - */ - public function testLimit() - { - $select = new Select; - self::assertSame($select, $select->limit(5)); - return $select; - } - - /** - * @testdox: unit test: Test getRawState() returns information populated via limit() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testLimit - */ - public function testGetRawStateViaLimit(Select $select) - { - self::assertEquals(5, $select->getRawState($select::LIMIT)); - } - - /** - * @testdox: unit test: test limit() throws execption when invalid parameter passed - * @covers \Zend\Db\Sql\Select::limit - */ - public function testLimitExceptionOnInvalidParameter() - { - $select = new Select; - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Zend\Db\Sql\Select::limit expects parameter to be numeric'); - $select->limit('foobar'); - } - - /** - * @testdox: unit test: test offset() - * @covers \Zend\Db\Sql\Select::offset - */ - public function testOffset() - { - $select = new Select; - self::assertSame($select, $select->offset(10)); - return $select; - } - - /** - * @testdox: unit test: Test getRawState() returns information populated via offset() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testOffset - */ - public function testGetRawStateViaOffset(Select $select) - { - self::assertEquals(10, $select->getRawState($select::OFFSET)); - } - - /** - * @testdox: unit test: test offset() throws exception when invalid parameter passed - * @covers \Zend\Db\Sql\Select::offset - */ - public function testOffsetExceptionOnInvalidParameter() - { - $select = new Select; - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Zend\Db\Sql\Select::offset expects parameter to be numeric'); - $select->offset('foobar'); - } - - - /** - * @testdox unit test: Test group() returns same Select object (is chainable) - * @covers \Zend\Db\Sql\Select::group - */ - public function testGroup() - { - $select = new Select; - $return = $select->group(['col1', 'col2']); - self::assertSame($select, $return); - - return $return; - } - - /** - * @testdox unit test: Test getRawState() returns information populated via group() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testGroup - */ - public function testGetRawStateViaGroup(Select $select) - { - self::assertEquals( - ['col1', 'col2'], - $select->getRawState('group') - ); - } - - /** - * @testdox unit test: Test having() returns same Select object (is chainable) - * @covers \Zend\Db\Sql\Select::having - */ - public function testHaving() - { - $select = new Select; - $return = $select->having(['x = ?' => 5]); - self::assertSame($select, $return); - - return $return; - } - - /** - * @testdox unit test: Test having() returns same Select object (is chainable) - * @covers \Zend\Db\Sql\Select::having - */ - public function testHavingArgument1IsHavingObject() - { - $select = new Select; - $having = new Having(); - $return = $select->having($having); - self::assertSame($select, $return); - self::assertSame($having, $select->getRawState('having')); - - return $return; - } - - /** - * @testdox unit test: Test getRawState() returns information populated via having() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testHaving - */ - public function testGetRawStateViaHaving(Select $select) - { - self::assertInstanceOf('Zend\Db\Sql\Having', $select->getRawState('having')); - } - - /** - * @testdox unit test: Test combine() returns same Select object (is chainable) - * @covers \Zend\Db\Sql\Select::combine - */ - public function testCombine() - { - $select = new Select; - $combine = new Select; - $return = $select->combine($combine, $select::COMBINE_UNION, 'ALL'); - self::assertSame($select, $return); - - return $return; - } - - /** - * @testdox unit test: Test getRawState() returns information populated via combine() - * @covers \Zend\Db\Sql\Select::getRawState - * @depends testCombine - */ - public function testGetRawStateViaCombine(Select $select) - { - $state = $select->getRawState('combine'); - self::assertInstanceOf('Zend\Db\Sql\Select', $state['select']); - self::assertNotSame($select, $state['select']); - self::assertEquals(Select::COMBINE_UNION, $state['type']); - self::assertEquals('ALL', $state['modifier']); - } - - /** - * @testdox unit test: Test reset() resets internal stat of Select object, based on input - * @covers \Zend\Db\Sql\Select::reset - */ - public function testReset() - { - $select = new Select; - - // table - $select->from('foo'); - self::assertEquals('foo', $select->getRawState(Select::TABLE)); - $select->reset(Select::TABLE); - self::assertNull($select->getRawState(Select::TABLE)); - - // columns - $select->columns(['foo']); - self::assertEquals(['foo'], $select->getRawState(Select::COLUMNS)); - $select->reset(Select::COLUMNS); - self::assertEmpty($select->getRawState(Select::COLUMNS)); - - // joins - $select->join('foo', 'id = boo'); - self::assertEquals( - [['name' => 'foo', 'on' => 'id = boo', 'columns' => ['*'], 'type' => 'inner']], - $select->getRawState(Select::JOINS)->getJoins() - ); - $select->reset(Select::JOINS); - self::assertEmpty($select->getRawState(Select::JOINS)->getJoins()); - - // where - $select->where('foo = bar'); - $where1 = $select->getRawState(Select::WHERE); - self::assertEquals(1, $where1->count()); - $select->reset(Select::WHERE); - $where2 = $select->getRawState(Select::WHERE); - self::assertEquals(0, $where2->count()); - self::assertNotSame($where1, $where2); - - // group - $select->group(['foo']); - self::assertEquals(['foo'], $select->getRawState(Select::GROUP)); - $select->reset(Select::GROUP); - self::assertEmpty($select->getRawState(Select::GROUP)); - - // having - $select->having('foo = bar'); - $having1 = $select->getRawState(Select::HAVING); - self::assertEquals(1, $having1->count()); - $select->reset(Select::HAVING); - $having2 = $select->getRawState(Select::HAVING); - self::assertEquals(0, $having2->count()); - self::assertNotSame($having1, $having2); - - // limit - $select->limit(5); - self::assertEquals(5, $select->getRawState(Select::LIMIT)); - $select->reset(Select::LIMIT); - self::assertNull($select->getRawState(Select::LIMIT)); - - // offset - $select->offset(10); - self::assertEquals(10, $select->getRawState(Select::OFFSET)); - $select->reset(Select::OFFSET); - self::assertNull($select->getRawState(Select::OFFSET)); - - // order - $select->order('foo asc'); - self::assertEquals(['foo asc'], $select->getRawState(Select::ORDER)); - $select->reset(Select::ORDER); - self::assertEmpty($select->getRawState(Select::ORDER)); - } - - /** - * @testdox unit test: Test prepareStatement() will produce expected sql and parameters based on - * a variety of provided arguments [uses data provider] - * @covers \Zend\Db\Sql\Select::prepareStatement - * @dataProvider providerData - */ - public function testPrepareStatement( - Select $select, - $expectedSqlString, - $expectedParameters, - $unused1, - $unused2, - $useNamedParameters = false - ) { - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnCallback( - function ($name) use ($useNamedParameters) { - return (($useNamedParameters) ? ':' . $name : '?'); - } - )); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $parameterContainer = new ParameterContainer(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('getParameterContainer') - ->will($this->returnValue($parameterContainer)); - $mockStatement->expects($this->any())->method('setSql')->with($this->equalTo($expectedSqlString)); - - $select->prepareStatement($mockAdapter, $mockStatement); - - if ($expectedParameters) { - self::assertEquals($expectedParameters, $parameterContainer->getNamedArray()); - } - } - - /** - * @group ZF2-5192 - */ - public function testSelectUsingTableIdentifierWithEmptyScheme() - { - $select = new Select; - $select->from(new TableIdentifier('foo')); - $select->join(new TableIdentifier('bar'), 'foo.id = bar.fooid'); - - self::assertEquals( - 'SELECT "foo".*, "bar".* FROM "foo" INNER JOIN "bar" ON "foo"."id" = "bar"."fooid"', - $select->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @testdox unit test: Test getSqlString() will produce expected sql and parameters based on - * a variety of provided arguments [uses data provider] - * @covers \Zend\Db\Sql\Select::getSqlString - * @dataProvider providerData - */ - public function testGetSqlString(Select $select, $unused, $unused2, $expectedSqlString) - { - self::assertEquals($expectedSqlString, $select->getSqlString(new TrustingSql92Platform())); - } - - /** - * @testdox unit test: Test __get() returns expected objects magically - * @covers \Zend\Db\Sql\Select::__get - */ - public function testMagicAccessor() - { - $select = new Select; - self::assertInstanceOf('Zend\Db\Sql\Where', $select->where); - } - - /** - * @testdox unit test: Test __clone() will clone the where object so that this select can be used - * in multiple contexts - * @covers \Zend\Db\Sql\Select::__clone - */ - public function testCloning() - { - $select = new Select; - $select1 = clone $select; - $select1->where('id = foo'); - $select1->having('id = foo'); - - self::assertEquals(0, $select->where->count()); - self::assertEquals(1, $select1->where->count()); - - self::assertEquals(0, $select->having->count()); - self::assertEquals(1, $select1->having->count()); - } - - /** - * @testdox unit test: Text process*() methods will return proper array when internally called, - * part of extension API - * @dataProvider providerData - * @covers \Zend\Db\Sql\Select::processSelect - * @covers \Zend\Db\Sql\Select::processJoins - * @covers \Zend\Db\Sql\Select::processWhere - * @covers \Zend\Db\Sql\Select::processGroup - * @covers \Zend\Db\Sql\Select::processHaving - * @covers \Zend\Db\Sql\Select::processOrder - * @covers \Zend\Db\Sql\Select::processLimit - * @covers \Zend\Db\Sql\Select::processOffset - * @covers \Zend\Db\Sql\Select::processCombine - */ - public function testProcessMethods(Select $select, $unused, $unused2, $unused3, $internalTests) - { - if (! $internalTests) { - return; - } - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $parameterContainer = new ParameterContainer(); - - $sr = new ReflectionObject($select); - - foreach ($internalTests as $method => $expected) { - $mr = $sr->getMethod($method); - $mr->setAccessible(true); - $return = $mr->invokeArgs($select, [new Sql92, $mockDriver, $parameterContainer]); - self::assertEquals($expected, $return); - } - } - - public function providerData() - { - // basic table - $select0 = new Select; - $select0->from('foo'); - $sqlPrep0 = // same - $sqlStr0 = 'SELECT "foo".* FROM "foo"'; - $internalTests0 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - ]; - - // table as TableIdentifier - $select1 = new Select; - $select1->from(new TableIdentifier('foo', 'bar')); - $sqlPrep1 = // same - $sqlStr1 = 'SELECT "bar"."foo".* FROM "bar"."foo"'; - $internalTests1 = [ - 'processSelect' => [[['"bar"."foo".*']], '"bar"."foo"'], - ]; - - // table with alias - $select2 = new Select; - $select2->from(['f' => 'foo']); - $sqlPrep2 = // same - $sqlStr2 = 'SELECT "f".* FROM "foo" AS "f"'; - $internalTests2 = [ - 'processSelect' => [[['"f".*']], '"foo" AS "f"'], - ]; - - // table with alias with table as TableIdentifier - $select3 = new Select; - $select3->from(['f' => new TableIdentifier('foo')]); - $sqlPrep3 = // same - $sqlStr3 = 'SELECT "f".* FROM "foo" AS "f"'; - $internalTests3 = [ - 'processSelect' => [[['"f".*']], '"foo" AS "f"'], - ]; - - // columns - $select4 = new Select; - $select4->from('foo')->columns(['bar', 'baz']); - $sqlPrep4 = // same - $sqlStr4 = 'SELECT "foo"."bar" AS "bar", "foo"."baz" AS "baz" FROM "foo"'; - $internalTests4 = [ - 'processSelect' => [[['"foo"."bar"', '"bar"'], ['"foo"."baz"', '"baz"']], '"foo"'], - ]; - - // columns with AS associative array - $select5 = new Select; - $select5->from('foo')->columns(['bar' => 'baz']); - $sqlPrep5 = // same - $sqlStr5 = 'SELECT "foo"."baz" AS "bar" FROM "foo"'; - $internalTests5 = [ - 'processSelect' => [[['"foo"."baz"', '"bar"']], '"foo"'], - ]; - - // columns with AS associative array mixed - $select6 = new Select; - $select6->from('foo')->columns(['bar' => 'baz', 'bam']); - $sqlPrep6 = // same - $sqlStr6 = 'SELECT "foo"."baz" AS "bar", "foo"."bam" AS "bam" FROM "foo"'; - $internalTests6 = [ - 'processSelect' => [[['"foo"."baz"', '"bar"'], ['"foo"."bam"', '"bam"'] ], '"foo"'], - ]; - - // columns where value is Expression, with AS - $select7 = new Select; - $select7->from('foo')->columns(['bar' => new Expression('COUNT(some_column)')]); - $sqlPrep7 = // same - $sqlStr7 = 'SELECT COUNT(some_column) AS "bar" FROM "foo"'; - $internalTests7 = [ - 'processSelect' => [[['COUNT(some_column)', '"bar"']], '"foo"'], - ]; - - // columns where value is Expression - $select8 = new Select; - $select8->from('foo')->columns([new Expression('COUNT(some_column) AS bar')]); - $sqlPrep8 = // same - $sqlStr8 = 'SELECT COUNT(some_column) AS bar FROM "foo"'; - $internalTests8 = [ - 'processSelect' => [[['COUNT(some_column) AS bar']], '"foo"'], - ]; - - // columns where value is Expression with parameters - $select9 = new Select; - $select9->from('foo')->columns( - [ - new Expression( - '(COUNT(?) + ?) AS ?', - ['some_column', 5, 'bar'], - [Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression::TYPE_IDENTIFIER] - ), - ] - ); - $sqlPrep9 = 'SELECT (COUNT("some_column") + ?) AS "bar" FROM "foo"'; - $sqlStr9 = 'SELECT (COUNT("some_column") + \'5\') AS "bar" FROM "foo"'; - $params9 = ['column1' => 5]; - $internalTests9 = [ - 'processSelect' => [[['(COUNT("some_column") + ?) AS "bar"']], '"foo"'], - ]; - - // joins (plain) - $select10 = new Select; - $select10->from('foo')->join('zac', 'm = n'); - $sqlPrep10 = // same - $sqlStr10 = 'SELECT "foo".*, "zac".* FROM "foo" INNER JOIN "zac" ON "m" = "n"'; - $internalTests10 = [ - 'processSelect' => [[['"foo".*'], ['"zac".*']], '"foo"'], - 'processJoins' => [[['INNER', '"zac"', '"m" = "n"']]], - ]; - - // join with columns - $select11 = new Select; - $select11->from('foo')->join('zac', 'm = n', ['bar', 'baz']); - // @codingStandardsIgnoreStart - $sqlPrep11 = // same - $sqlStr11 = 'SELECT "foo".*, "zac"."bar" AS "bar", "zac"."baz" AS "baz" FROM "foo" INNER JOIN "zac" ON "m" = "n"'; - // @codingStandardsIgnoreEnd - $internalTests11 = [ - 'processSelect' => [[['"foo".*'], ['"zac"."bar"', '"bar"'], ['"zac"."baz"', '"baz"']], '"foo"'], - 'processJoins' => [[['INNER', '"zac"', '"m" = "n"']]], - ]; - - // join with alternate type - $select12 = new Select; - $select12->from('foo')->join('zac', 'm = n', ['bar', 'baz'], Select::JOIN_OUTER); - // @codingStandardsIgnoreStart - $sqlPrep12 = // same - $sqlStr12 = 'SELECT "foo".*, "zac"."bar" AS "bar", "zac"."baz" AS "baz" FROM "foo" OUTER JOIN "zac" ON "m" = "n"'; - // @codingStandardsIgnoreEnd - $internalTests12 = [ - 'processSelect' => [[['"foo".*'], ['"zac"."bar"', '"bar"'], ['"zac"."baz"', '"baz"']], '"foo"'], - 'processJoins' => [[['OUTER', '"zac"', '"m" = "n"']]], - ]; - - // join with column aliases - $select13 = new Select; - $select13->from('foo')->join('zac', 'm = n', ['BAR' => 'bar', 'BAZ' => 'baz']); - // @codingStandardsIgnoreStart - $sqlPrep13 = // same - $sqlStr13 = 'SELECT "foo".*, "zac"."bar" AS "BAR", "zac"."baz" AS "BAZ" FROM "foo" INNER JOIN "zac" ON "m" = "n"'; - // @codingStandardsIgnoreEnd - $internalTests13 = [ - 'processSelect' => [[['"foo".*'], ['"zac"."bar"', '"BAR"'], ['"zac"."baz"', '"BAZ"']], '"foo"'], - 'processJoins' => [[['INNER', '"zac"', '"m" = "n"']]], - ]; - - // join with table aliases - $select14 = new Select; - $select14->from('foo')->join(['b' => 'bar'], 'b.foo_id = foo.foo_id'); - $sqlPrep14 = // same - $sqlStr14 = 'SELECT "foo".*, "b".* FROM "foo" INNER JOIN "bar" AS "b" ON "b"."foo_id" = "foo"."foo_id"'; - $internalTests14 = [ - 'processSelect' => [[['"foo".*'], ['"b".*']], '"foo"'], - 'processJoins' => [[['INNER', '"bar" AS "b"', '"b"."foo_id" = "foo"."foo_id"']]], - ]; - - // where (simple string) - $select15 = new Select; - $select15->from('foo')->where('x = 5'); - $sqlPrep15 = // same - $sqlStr15 = 'SELECT "foo".* FROM "foo" WHERE x = 5'; - $internalTests15 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processWhere' => ['x = 5'], - ]; - - // where (returning parameters) - $select16 = new Select; - $select16->from('foo')->where(['x = ?' => 5]); - $sqlPrep16 = 'SELECT "foo".* FROM "foo" WHERE x = ?'; - $sqlStr16 = 'SELECT "foo".* FROM "foo" WHERE x = \'5\''; - $params16 = ['where1' => 5]; - $internalTests16 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processWhere' => ['x = ?'], - ]; - - // group - $select17 = new Select; - $select17->from('foo')->group(['col1', 'col2']); - $sqlPrep17 = // same - $sqlStr17 = 'SELECT "foo".* FROM "foo" GROUP BY "col1", "col2"'; - $internalTests17 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processGroup' => [['"col1"', '"col2"']], - ]; - - $select18 = new Select; - $select18->from('foo')->group('col1')->group('col2'); - $sqlPrep18 = // same - $sqlStr18 = 'SELECT "foo".* FROM "foo" GROUP BY "col1", "col2"'; - $internalTests18 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processGroup' => [['"col1"', '"col2"']], - ]; - - $select19 = new Select; - $select19->from('foo')->group(new Expression('DAY(?)', ['col1'], [Expression::TYPE_IDENTIFIER])); - $sqlPrep19 = // same - $sqlStr19 = 'SELECT "foo".* FROM "foo" GROUP BY DAY("col1")'; - $internalTests19 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processGroup' => [['DAY("col1")']], - ]; - - // having (simple string) - $select20 = new Select; - $select20->from('foo')->having('x = 5'); - $sqlPrep20 = // same - $sqlStr20 = 'SELECT "foo".* FROM "foo" HAVING x = 5'; - $internalTests20 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processHaving' => ['x = 5'], - ]; - - // having (returning parameters) - $select21 = new Select; - $select21->from('foo')->having(['x = ?' => 5]); - $sqlPrep21 = 'SELECT "foo".* FROM "foo" HAVING x = ?'; - $sqlStr21 = 'SELECT "foo".* FROM "foo" HAVING x = \'5\''; - $params21 = ['having1' => 5]; - $internalTests21 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processHaving' => ['x = ?'], - ]; - - // order - $select22 = new Select; - $select22->from('foo')->order('c1'); - $sqlPrep22 = // - $sqlStr22 = 'SELECT "foo".* FROM "foo" ORDER BY "c1" ASC'; - $internalTests22 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processOrder' => [[['"c1"', Select::ORDER_ASCENDING]]], - ]; - - $select23 = new Select; - $select23->from('foo')->order(['c1', 'c2']); - $sqlPrep23 = // same - $sqlStr23 = 'SELECT "foo".* FROM "foo" ORDER BY "c1" ASC, "c2" ASC'; - $internalTests23 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processOrder' => [[['"c1"', Select::ORDER_ASCENDING], ['"c2"', Select::ORDER_ASCENDING]]], - ]; - - $select24 = new Select; - $select24->from('foo')->order(['c1' => 'DESC', 'c2' => 'Asc']); // notice partially lower case ASC - $sqlPrep24 = // same - $sqlStr24 = 'SELECT "foo".* FROM "foo" ORDER BY "c1" DESC, "c2" ASC'; - $internalTests24 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processOrder' => [[['"c1"', Select::ORDER_DESCENDING], ['"c2"', Select::ORDER_ASCENDING]]], - ]; - - $select25 = new Select; - $select25->from('foo')->order(['c1' => 'asc'])->order('c2 desc'); // notice partially lower case ASC - $sqlPrep25 = // same - $sqlStr25 = 'SELECT "foo".* FROM "foo" ORDER BY "c1" ASC, "c2" DESC'; - $internalTests25 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processOrder' => [[['"c1"', Select::ORDER_ASCENDING], ['"c2"', Select::ORDER_DESCENDING]]], - ]; - - // limit - $select26 = new Select; - $select26->from('foo')->limit(5); - $sqlPrep26 = 'SELECT "foo".* FROM "foo" LIMIT ?'; - $sqlStr26 = 'SELECT "foo".* FROM "foo" LIMIT \'5\''; - $params26 = ['limit' => 5]; - $internalTests26 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processLimit' => ['?'], - ]; - - // limit with offset - $select27 = new Select; - $select27->from('foo')->limit(5)->offset(10); - $sqlPrep27 = 'SELECT "foo".* FROM "foo" LIMIT ? OFFSET ?'; - $sqlStr27 = 'SELECT "foo".* FROM "foo" LIMIT \'5\' OFFSET \'10\''; - $params27 = ['limit' => 5, 'offset' => 10]; - $internalTests27 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processLimit' => ['?'], - 'processOffset' => ['?'], - ]; - - // joins with a few keywords in the on clause - $select28 = new Select; - // @codingStandardsIgnoreStart - $select28->from('foo')->join('zac', '(m = n AND c.x) BETWEEN x AND y.z OR (c.x < y.z AND c.x <= y.z AND c.x > y.z AND c.x >= y.z)'); - $sqlPrep28 = // same - $sqlStr28 = 'SELECT "foo".*, "zac".* FROM "foo" INNER JOIN "zac" ON ("m" = "n" AND "c"."x") BETWEEN "x" AND "y"."z" OR ("c"."x" < "y"."z" AND "c"."x" <= "y"."z" AND "c"."x" > "y"."z" AND "c"."x" >= "y"."z")'; - // @codingStandardsIgnoreEnd - $internalTests28 = [ - 'processSelect' => [[['"foo".*'], ['"zac".*']], '"foo"'], - // @codingStandardsIgnoreStart - 'processJoins' => [[['INNER', '"zac"', '("m" = "n" AND "c"."x") BETWEEN "x" AND "y"."z" OR ("c"."x" < "y"."z" AND "c"."x" <= "y"."z" AND "c"."x" > "y"."z" AND "c"."x" >= "y"."z")']]], - // @codingStandardsIgnoreEnd - ]; - - // order with compound name - $select29 = new Select; - $select29->from('foo')->order('c1.d2'); - $sqlPrep29 = // - $sqlStr29 = 'SELECT "foo".* FROM "foo" ORDER BY "c1"."d2" ASC'; - $internalTests29 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processOrder' => [[['"c1"."d2"', Select::ORDER_ASCENDING]]], - ]; - - // group with compound name - $select30 = new Select; - $select30->from('foo')->group('c1.d2'); - $sqlPrep30 = // same - $sqlStr30 = 'SELECT "foo".* FROM "foo" GROUP BY "c1"."d2"'; - $internalTests30 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processGroup' => [['"c1"."d2"']], - ]; - - // join with expression in ON part - $select31 = new Select; - $select31->from('foo')->join('zac', new Expression('(m = n AND c.x) BETWEEN x AND y.z')); - $sqlPrep31 = // same - $sqlStr31 = 'SELECT "foo".*, "zac".* FROM "foo" INNER JOIN "zac" ON (m = n AND c.x) BETWEEN x AND y.z'; - $internalTests31 = [ - 'processSelect' => [[['"foo".*'], ['"zac".*']], '"foo"'], - 'processJoins' => [[['INNER', '"zac"', '(m = n AND c.x) BETWEEN x AND y.z']]], - ]; - - $select32subselect = new Select; - $select32subselect->from('bar')->where->like('y', '%Foo%'); - $select32 = new Select; - $select32->from(['x' => $select32subselect]); - $sqlPrep32 = 'SELECT "x".* FROM (SELECT "bar".* FROM "bar" WHERE "y" LIKE ?) AS "x"'; - $sqlStr32 = 'SELECT "x".* FROM (SELECT "bar".* FROM "bar" WHERE "y" LIKE \'%Foo%\') AS "x"'; - $internalTests32 = [ - 'processSelect' => [[['"x".*']], '(SELECT "bar".* FROM "bar" WHERE "y" LIKE ?) AS "x"'], - ]; - - $select33 = new Select; - $select33->from('table')->columns(['*'])->where([ - 'c1' => null, - 'c2' => [1, 2, 3], - new \Zend\Db\Sql\Predicate\IsNotNull('c3'), - ]); - $sqlPrep33 = 'SELECT "table".* FROM "table" WHERE "c1" IS NULL AND "c2" IN (?, ?, ?) AND "c3" IS NOT NULL'; - // @codingStandardsIgnoreStart - $sqlStr33 = 'SELECT "table".* FROM "table" WHERE "c1" IS NULL AND "c2" IN (\'1\', \'2\', \'3\') AND "c3" IS NOT NULL'; - // @codingStandardsIgnoreEnd - $internalTests33 = [ - 'processSelect' => [[['"table".*']], '"table"'], - 'processWhere' => ['"c1" IS NULL AND "c2" IN (?, ?, ?) AND "c3" IS NOT NULL'], - ]; - - // @author Demian Katz - $select34 = new Select; - $select34->from('table')->order([ - new Expression('isnull(?) DESC', ['name'], [Expression::TYPE_IDENTIFIER]), - 'name', - ]); - $sqlPrep34 = 'SELECT "table".* FROM "table" ORDER BY isnull("name") DESC, "name" ASC'; - $sqlStr34 = 'SELECT "table".* FROM "table" ORDER BY isnull("name") DESC, "name" ASC'; - $internalTests34 = [ - 'processOrder' => [[['isnull("name") DESC'], ['"name"', Select::ORDER_ASCENDING]]], - ]; - - // join with Expression object in COLUMNS part (ZF2-514) - // @co-author Koen Pieters (kpieters) - $select35 = new Select; - $select35->from('foo')->columns([])->join('bar', 'm = n', ['thecount' => new Expression("COUNT(*)")]); - $sqlPrep35 = // same - $sqlStr35 = 'SELECT COUNT(*) AS "thecount" FROM "foo" INNER JOIN "bar" ON "m" = "n"'; - $internalTests35 = [ - 'processSelect' => [[['COUNT(*)', '"thecount"']], '"foo"'], - 'processJoins' => [[['INNER', '"bar"', '"m" = "n"']]], - ]; - - // multiple joins with expressions - // reported by @jdolieslager - $select36 = new Select; - $select36->from('foo') - ->join('tableA', new Predicate\Operator('id', '=', 1)) - ->join('tableB', new Predicate\Operator('id', '=', 2)) - ->join('tableC', new Predicate\PredicateSet([ - new Predicate\Operator('id', '=', 3), - new Predicate\Operator('number', '>', 20), - ])); - $sqlPrep36 = 'SELECT "foo".*, "tableA".*, "tableB".*, "tableC".* FROM "foo"' - . ' INNER JOIN "tableA" ON "id" = :join1part1 INNER JOIN "tableB" ON "id" = :join2part1 ' - . 'INNER JOIN "tableC" ON "id" = :join3part1 AND "number" > :join3part2'; - $sqlStr36 = 'SELECT "foo".*, "tableA".*, "tableB".*, "tableC".* FROM "foo" ' - . 'INNER JOIN "tableA" ON "id" = \'1\' INNER JOIN "tableB" ON "id" = \'2\' ' - . 'INNER JOIN "tableC" ON "id" = \'3\' AND "number" > \'20\''; - $internalTests36 = []; - $useNamedParams36 = true; - - /** - * @author robertbasic - * @link https://github.com/zendframework/zf2/pull/2714 - */ - $select37 = new Select; - $select37->from('foo')->columns(['bar'], false); - $sqlPrep37 = // same - $sqlStr37 = 'SELECT "bar" AS "bar" FROM "foo"'; - $internalTests37 = [ - 'processSelect' => [[['"bar"', '"bar"']], '"foo"'], - ]; - - // @link https://github.com/zendframework/zf2/issues/3294 - // Test TableIdentifier In Joins - $select38 = new Select; - $select38->from('foo')->columns([]) - ->join(new TableIdentifier('bar', 'baz'), 'm = n', ['thecount' => new Expression("COUNT(*)")]); - $sqlPrep38 = // same - $sqlStr38 = 'SELECT COUNT(*) AS "thecount" FROM "foo" INNER JOIN "baz"."bar" ON "m" = "n"'; - $internalTests38 = [ - 'processSelect' => [[['COUNT(*)', '"thecount"']], '"foo"'], - 'processJoins' => [[['INNER', '"baz"."bar"', '"m" = "n"']]], - ]; - - // subselect in join - $select39subselect = new Select; - $select39subselect->from('bar')->where->like('y', '%Foo%'); - $select39 = new Select; - $select39->from('foo')->join(['z' => $select39subselect], 'z.foo = bar.id'); - // @codingStandardsIgnoreStart - $sqlPrep39 = 'SELECT "foo".*, "z".* FROM "foo" INNER JOIN (SELECT "bar".* FROM "bar" WHERE "y" LIKE ?) AS "z" ON "z"."foo" = "bar"."id"'; - $sqlStr39 = 'SELECT "foo".*, "z".* FROM "foo" INNER JOIN (SELECT "bar".* FROM "bar" WHERE "y" LIKE \'%Foo%\') AS "z" ON "z"."foo" = "bar"."id"'; - // @codingStandardsIgnoreEnd - $internalTests39 = [ - 'processJoins' => [ - [['INNER', '(SELECT "bar".* FROM "bar" WHERE "y" LIKE ?) AS "z"', '"z"."foo" = "bar"."id"']], - ], - ]; - - // @link https://github.com/zendframework/zf2/issues/3294 - // Test TableIdentifier In Joins, with multiple joins - $select40 = new Select; - $select40->from('foo') - ->join(['a' => new TableIdentifier('another_foo', 'another_schema')], 'a.x = foo.foo_column') - ->join('bar', 'foo.colx = bar.colx'); - $sqlPrep40 = // same - $sqlStr40 = 'SELECT "foo".*, "a".*, "bar".* FROM "foo"' - . ' INNER JOIN "another_schema"."another_foo" AS "a" ON "a"."x" = "foo"."foo_column"' - . ' INNER JOIN "bar" ON "foo"."colx" = "bar"."colx"'; - $internalTests40 = [ - 'processSelect' => [[['"foo".*'], ['"a".*'], ['"bar".*']], '"foo"'], - 'processJoins' => [[ - ['INNER', '"another_schema"."another_foo" AS "a"', '"a"."x" = "foo"."foo_column"'], - ['INNER', '"bar"', '"foo"."colx" = "bar"."colx"'], - ]], - ]; - - $select41 = new Select; - $select41->from('foo')->quantifier(Select::QUANTIFIER_DISTINCT); - $sqlPrep41 = // same - $sqlStr41 = 'SELECT DISTINCT "foo".* FROM "foo"'; - $internalTests41 = [ - 'processSelect' => [SELECT::QUANTIFIER_DISTINCT, [['"foo".*']], '"foo"'], - ]; - - $select42 = new Select; - $select42->from('foo')->quantifier(new Expression('TOP ?', [10])); - $sqlPrep42 = 'SELECT TOP ? "foo".* FROM "foo"'; - $sqlStr42 = 'SELECT TOP \'10\' "foo".* FROM "foo"'; - $internalTests42 = [ - 'processSelect' => ['TOP ?', [['"foo".*']], '"foo"'], - ]; - - $select43 = new Select(); - $select43->from(['x' => 'foo'])->columns(['bar' => 'foo.bar'], false); - $sqlPrep43 = 'SELECT "foo"."bar" AS "bar" FROM "foo" AS "x"'; - $sqlStr43 = 'SELECT "foo"."bar" AS "bar" FROM "foo" AS "x"'; - $internalTests43 = [ - 'processSelect' => [[['"foo"."bar"', '"bar"']], '"foo" AS "x"'], - ]; - - $select44 = new Select; - $select44->from('foo')->where('a = b'); - $select44b = new Select; - $select44b->from('bar')->where('c = d'); - $select44->combine($select44b, Select::COMBINE_UNION, 'ALL'); - $sqlPrep44 = // same - $sqlStr44 = '( SELECT "foo".* FROM "foo" WHERE a = b ) UNION ALL ( SELECT "bar".* FROM "bar" WHERE c = d )'; - $internalTests44 = [ - 'processCombine' => ['UNION ALL', 'SELECT "bar".* FROM "bar" WHERE c = d'], - ]; - - // limit with offset - $select45 = new Select; - $select45->from('foo')->limit("5")->offset("10"); - $sqlPrep45 = 'SELECT "foo".* FROM "foo" LIMIT ? OFFSET ?'; - $sqlStr45 = 'SELECT "foo".* FROM "foo" LIMIT \'5\' OFFSET \'10\''; - $params45 = ['limit' => 5, 'offset' => 10]; - $internalTests45 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processLimit' => ['?'], - 'processOffset' => ['?'], - ]; - - // functions without table - $select46 = new Select; - $select46->columns([ - new Expression('SOME_DB_FUNCTION_ONE()'), - 'foo' => new Expression('SOME_DB_FUNCTION_TWO()'), - ]); - $sqlPrep46 = 'SELECT SOME_DB_FUNCTION_ONE() AS Expression1, SOME_DB_FUNCTION_TWO() AS "foo"'; - $sqlStr46 = 'SELECT SOME_DB_FUNCTION_ONE() AS Expression1, SOME_DB_FUNCTION_TWO() AS "foo"'; - $params46 = []; - $internalTests46 = []; - - // limit with big offset and limit - $select47 = new Select; - $select47->from('foo')->limit("10000000000000000000")->offset("10000000000000000000"); - $sqlPrep47 = 'SELECT "foo".* FROM "foo" LIMIT ? OFFSET ?'; - $sqlStr47 = 'SELECT "foo".* FROM "foo" LIMIT \'10000000000000000000\' OFFSET \'10000000000000000000\''; - $params47 = ['limit' => 10000000000000000000, 'offset' => 10000000000000000000]; - $internalTests47 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processLimit' => ['?'], - 'processOffset' => ['?'], - ]; - - //combine and union with order at the end - $select48 = new Select; - $select48->from('foo')->where('a = b'); - $select48b = new Select; - $select48b->from('bar')->where('c = d'); - $select48->combine($select48b); - - $select48combined = new Select(); - $select48 = $select48combined->from(['sub' => $select48])->order('id DESC'); - // @codingStandardsIgnoreStart - $sqlPrep48 = // same - $sqlStr48 = 'SELECT "sub".* FROM (( SELECT "foo".* FROM "foo" WHERE a = b ) UNION ( SELECT "bar".* FROM "bar" WHERE c = d )) AS "sub" ORDER BY "id" DESC'; - // @codingStandardsIgnoreEnd - $internalTests48 = [ - 'processCombine' => null, - ]; - - //Expression as joinName - $select49 = new Select; - $select49->from(new TableIdentifier('foo')) - ->join(['bar' => new Expression('psql_function_which_returns_table')], 'foo.id = bar.fooid'); - // @codingStandardsIgnoreStart - $sqlPrep49 = // same - $sqlStr49 = 'SELECT "foo".*, "bar".* FROM "foo" INNER JOIN psql_function_which_returns_table AS "bar" ON "foo"."id" = "bar"."fooid"'; - // @codingStandardsIgnoreEnd - $internalTests49 = [ - 'processSelect' => [[['"foo".*'], ['"bar".*']], '"foo"'], - 'processJoins' => [[['INNER', 'psql_function_which_returns_table AS "bar"', '"foo"."id" = "bar"."fooid"']]], - ]; - - // Test generic predicate is appended with AND - $select50 = new Select; - $select50->from(new TableIdentifier('foo')) - ->where - ->nest - ->isNull('bar') - ->and - ->predicate(new Predicate\Literal('1=1')) - ->unnest; - $sqlPrep50 = // same - $sqlStr50 = 'SELECT "foo".* FROM "foo" WHERE ("bar" IS NULL AND 1=1)'; - $internalTests50 = []; - - // Test generic predicate is appended with OR - $select51 = new Select; - $select51->from(new TableIdentifier('foo')) - ->where - ->nest - ->isNull('bar') - ->or - ->predicate(new Predicate\Literal('1=1')) - ->unnest; - $sqlPrep51 = // same - $sqlStr51 = 'SELECT "foo".* FROM "foo" WHERE ("bar" IS NULL OR 1=1)'; - $internalTests51 = []; - - /** - * @author Andrzej Lewandowski - * @link https://github.com/zendframework/zf2/issues/7222 - */ - $select52 = new Select; - $select52->from('foo')->join('zac', '(catalog_category_website.category_id = catalog_category.category_id)'); - // @codingStandardsIgnoreStart - $sqlPrep52 = // same - $sqlStr52 = 'SELECT "foo".*, "zac".* FROM "foo" INNER JOIN "zac" ON ("catalog_category_website"."category_id" = "catalog_category"."category_id")'; - // @codingStandardsIgnoreEnd - $internalTests52 = [ - 'processSelect' => [[['"foo".*'], ['"zac".*']], '"foo"'], - 'processJoins' => [[ - ['INNER', '"zac"', '("catalog_category_website"."category_id" = "catalog_category"."category_id")'], - ]], - ]; - - $subSelect53 = new Select; - $subSelect53->from('bar')->columns(['id'])->limit(10)->offset(9); - $select53 = new Select; - $select53->from('foo')->where(new In('bar_id', $subSelect53))->limit(11)->offset(12); - $params53 = ['limit' => 11, 'offset' => 12, 'subselect1limit' => 10, 'subselect1offset' => 9]; - // @codingStandardsIgnoreStart - $sqlPrep53 = 'SELECT "foo".* FROM "foo" WHERE "bar_id" IN (SELECT "bar"."id" AS "id" FROM "bar" LIMIT :subselect1limit OFFSET :subselect1offset) LIMIT :limit OFFSET :offset'; - $sqlStr53 = 'SELECT "foo".* FROM "foo" WHERE "bar_id" IN (SELECT "bar"."id" AS "id" FROM "bar" LIMIT \'10\' OFFSET \'9\') LIMIT \'11\' OFFSET \'12\''; - // @codingStandardsIgnoreEnd - $internalTests53 = [ - 'processSelect' => [[['"foo".*']], '"foo"'], - 'processWhere' => ['"bar_id" IN (SELECT "bar"."id" AS "id" FROM "bar" LIMIT ? OFFSET ?)'], - 'processLimit' => ['?'], - 'processOffset' => ['?'], - ]; - - /** - * $select = the select object - * $sqlPrep = the sql as a result of preparation - * $params = the param container contents result of preparation - * $sqlStr = the sql as a result of getting a string back - * $internalTests what the internal functions should return (safe-guarding extension) - */ - - return [ - // $select $sqlPrep $params $sqlStr $internalTests // use named param - [$select0, $sqlPrep0, [], $sqlStr0, $internalTests0], - [$select1, $sqlPrep1, [], $sqlStr1, $internalTests1], - [$select2, $sqlPrep2, [], $sqlStr2, $internalTests2], - [$select3, $sqlPrep3, [], $sqlStr3, $internalTests3], - [$select4, $sqlPrep4, [], $sqlStr4, $internalTests4], - [$select5, $sqlPrep5, [], $sqlStr5, $internalTests5], - [$select6, $sqlPrep6, [], $sqlStr6, $internalTests6], - [$select7, $sqlPrep7, [], $sqlStr7, $internalTests7], - [$select8, $sqlPrep8, [], $sqlStr8, $internalTests8], - [$select9, $sqlPrep9, $params9, $sqlStr9, $internalTests9], - [$select10, $sqlPrep10, [], $sqlStr10, $internalTests10], - [$select11, $sqlPrep11, [], $sqlStr11, $internalTests11], - [$select12, $sqlPrep12, [], $sqlStr12, $internalTests12], - [$select13, $sqlPrep13, [], $sqlStr13, $internalTests13], - [$select14, $sqlPrep14, [], $sqlStr14, $internalTests14], - [$select15, $sqlPrep15, [], $sqlStr15, $internalTests15], - [$select16, $sqlPrep16, $params16, $sqlStr16, $internalTests16], - [$select17, $sqlPrep17, [], $sqlStr17, $internalTests17], - [$select18, $sqlPrep18, [], $sqlStr18, $internalTests18], - [$select19, $sqlPrep19, [], $sqlStr19, $internalTests19], - [$select20, $sqlPrep20, [], $sqlStr20, $internalTests20], - [$select21, $sqlPrep21, $params21, $sqlStr21, $internalTests21], - [$select22, $sqlPrep22, [], $sqlStr22, $internalTests22], - [$select23, $sqlPrep23, [], $sqlStr23, $internalTests23], - [$select24, $sqlPrep24, [], $sqlStr24, $internalTests24], - [$select25, $sqlPrep25, [], $sqlStr25, $internalTests25], - [$select26, $sqlPrep26, $params26, $sqlStr26, $internalTests26], - [$select27, $sqlPrep27, $params27, $sqlStr27, $internalTests27], - [$select28, $sqlPrep28, [], $sqlStr28, $internalTests28], - [$select29, $sqlPrep29, [], $sqlStr29, $internalTests29], - [$select30, $sqlPrep30, [], $sqlStr30, $internalTests30], - [$select31, $sqlPrep31, [], $sqlStr31, $internalTests31], - [$select32, $sqlPrep32, [], $sqlStr32, $internalTests32], - [$select33, $sqlPrep33, [], $sqlStr33, $internalTests33], - [$select34, $sqlPrep34, [], $sqlStr34, $internalTests34], - [$select35, $sqlPrep35, [], $sqlStr35, $internalTests35], - [$select36, $sqlPrep36, [], $sqlStr36, $internalTests36, $useNamedParams36], - [$select37, $sqlPrep37, [], $sqlStr37, $internalTests37], - [$select38, $sqlPrep38, [], $sqlStr38, $internalTests38], - [$select39, $sqlPrep39, [], $sqlStr39, $internalTests39], - [$select40, $sqlPrep40, [], $sqlStr40, $internalTests40], - [$select41, $sqlPrep41, [], $sqlStr41, $internalTests41], - [$select42, $sqlPrep42, [], $sqlStr42, $internalTests42], - [$select43, $sqlPrep43, [], $sqlStr43, $internalTests43], - [$select44, $sqlPrep44, [], $sqlStr44, $internalTests44], - [$select45, $sqlPrep45, $params45, $sqlStr45, $internalTests45], - [$select46, $sqlPrep46, $params46, $sqlStr46, $internalTests46], - [$select47, $sqlPrep47, $params47, $sqlStr47, $internalTests47], - [$select48, $sqlPrep48, [], $sqlStr48, $internalTests48], - [$select49, $sqlPrep49, [], $sqlStr49, $internalTests49], - [$select50, $sqlPrep50, [], $sqlStr50, $internalTests50], - [$select51, $sqlPrep51, [], $sqlStr51, $internalTests51], - [$select52, $sqlPrep52, [], $sqlStr52, $internalTests52], - [$select53, $sqlPrep53, $params53, $sqlStr53, $internalTests53, true], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlFunctionalTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlFunctionalTest.php deleted file mode 100644 index 0160eafc..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlFunctionalTest.php +++ /dev/null @@ -1,624 +0,0 @@ - [ - 'sqlObject' => $this->select('foo')->offset(10), - 'expected' => [ - 'sql92' => [ - 'string' => 'SELECT "foo".* FROM "foo" OFFSET \'10\'', - 'prepare' => 'SELECT "foo".* FROM "foo" OFFSET ?', - 'parameters' => ['offset' => 10], - ], - 'MySql' => [ - 'string' => 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET 10', - 'prepare' => 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET ?', - 'parameters' => ['offset' => 10], - ], - // @codingStandardsIgnoreStart - 'Oracle' => [ - 'string' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b ) WHERE b_rownum > (10)', - 'prepare' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b ) WHERE b_rownum > (:offset)', - 'parameters' => ['offset' => 10], - ], - 'SqlServer' => [ - 'string' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 0+10', - 'prepare' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?', - 'parameters' => ['offset' => 10, 'limit' => null, 'offsetForSum' => 10], - ], - // @codingStandardsIgnoreEnd - ], - ], - 'Select::processLimit()' => [ - 'sqlObject' => $this->select('foo')->limit(10), - 'expected' => [ - 'sql92' => [ - 'string' => 'SELECT "foo".* FROM "foo" LIMIT \'10\'', - 'prepare' => 'SELECT "foo".* FROM "foo" LIMIT ?', - 'parameters' => ['limit' => 10], - ], - 'MySql' => [ - 'string' => 'SELECT `foo`.* FROM `foo` LIMIT 10', - 'prepare' => 'SELECT `foo`.* FROM `foo` LIMIT ?', - 'parameters' => ['limit' => 10], - ], - // @codingStandardsIgnoreStart - 'Oracle' => [ - 'string' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b WHERE rownum <= (0+10)) WHERE b_rownum >= (0 + 1)', - 'prepare' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b WHERE rownum <= (:offset+:limit)) WHERE b_rownum >= (:offset + 1)', - 'parameters' => ['offset' => 0, 'limit' => 10], - ], - 'SqlServer' => [ - 'string' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 0+1 AND 10+0', - 'prepare' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?', - 'parameters' => ['offset' => null, 'limit' => 10, 'offsetForSum' => null], - ], - // @codingStandardsIgnoreEnd - ], - ], - 'Select::processLimitOffset()' => [ - 'sqlObject' => $this->select('foo')->limit(10)->offset(5), - 'expected' => [ - 'sql92' => [ - 'string' => 'SELECT "foo".* FROM "foo" LIMIT \'10\' OFFSET \'5\'', - 'prepare' => 'SELECT "foo".* FROM "foo" LIMIT ? OFFSET ?', - 'parameters' => ['limit' => 10, 'offset' => 5], - ], - 'MySql' => [ - 'string' => 'SELECT `foo`.* FROM `foo` LIMIT 10 OFFSET 5', - 'prepare' => 'SELECT `foo`.* FROM `foo` LIMIT ? OFFSET ?', - 'parameters' => ['limit' => 10, 'offset' => 5], - ], - // @codingStandardsIgnoreStart - 'Oracle' => [ - 'string' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b WHERE rownum <= (5+10)) WHERE b_rownum >= (5 + 1)', - 'prepare' => 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b WHERE rownum <= (:offset+:limit)) WHERE b_rownum >= (:offset + 1)', - 'parameters' => ['offset' => 5, 'limit' => 10], - ], - 'SqlServer' => [ - 'string' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 5+1 AND 10+5', - 'prepare' => 'SELECT * FROM ( SELECT [foo].*, ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS [__ZEND_ROW_NUMBER] FROM [foo] ) AS [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?', - 'parameters' => ['offset' => 5, 'limit' => 10, 'offsetForSum' => 5], - ], - // @codingStandardsIgnoreEnd - ], - ], - // Github issue https://github.com/zendframework/zend-db/issues/98 - 'Select::processJoinNoJoinedColumns()' => [ - 'sqlObject' => $this->select('my_table') - ->join( - 'joined_table2', - 'my_table.id = joined_table2.id', - $columns = [] - ) - ->join( - 'joined_table3', - 'my_table.id = joined_table3.id', - [\Zend\Db\Sql\Select::SQL_STAR] - ) - ->columns([ - 'my_table_column', - 'aliased_column' => new \Zend\Db\Sql\Expression('NOW()'), - ]), - 'expected' => [ - // @codingStandardsIgnoreStart - 'sql92' => [ - 'string' => 'SELECT "my_table"."my_table_column" AS "my_table_column", NOW() AS "aliased_column", "joined_table3".* FROM "my_table" INNER JOIN "joined_table2" ON "my_table"."id" = "joined_table2"."id" INNER JOIN "joined_table3" ON "my_table"."id" = "joined_table3"."id"', - ], - 'MySql' => [ - 'string' => 'SELECT `my_table`.`my_table_column` AS `my_table_column`, NOW() AS `aliased_column`, `joined_table3`.* FROM `my_table` INNER JOIN `joined_table2` ON `my_table`.`id` = `joined_table2`.`id` INNER JOIN `joined_table3` ON `my_table`.`id` = `joined_table3`.`id`', - ], - 'Oracle' => [ - 'string' => 'SELECT "my_table"."my_table_column" AS "my_table_column", NOW() AS "aliased_column", "joined_table3".* FROM "my_table" INNER JOIN "joined_table2" ON "my_table"."id" = "joined_table2"."id" INNER JOIN "joined_table3" ON "my_table"."id" = "joined_table3"."id"', - ], - 'SqlServer' => [ - 'string' => 'SELECT [my_table].[my_table_column] AS [my_table_column], NOW() AS [aliased_column], [joined_table3].* FROM [my_table] INNER JOIN [joined_table2] ON [my_table].[id] = [joined_table2].[id] INNER JOIN [joined_table3] ON [my_table].[id] = [joined_table3].[id]', - ] - // @codingStandardsIgnoreEnd - ] - ], - 'Select::processJoin()' => [ - 'sqlObject' => $this->select('a') - ->join(['b' => $this->select('c')->where(['cc' => 10])], 'd=e')->where(['x' => 20]), - 'expected' => [ - // @codingStandardsIgnoreStart - 'sql92' => [ - 'string' => 'SELECT "a".*, "b".* FROM "a" INNER JOIN (SELECT "c".* FROM "c" WHERE "cc" = \'10\') AS "b" ON "d"="e" WHERE "x" = \'20\'', - 'prepare' => 'SELECT "a".*, "b".* FROM "a" INNER JOIN (SELECT "c".* FROM "c" WHERE "cc" = ?) AS "b" ON "d"="e" WHERE "x" = ?', - 'parameters' => ['subselect1where1' => 10, 'where1' => 20], - ], - 'MySql' => [ - 'string' => 'SELECT `a`.*, `b`.* FROM `a` INNER JOIN (SELECT `c`.* FROM `c` WHERE `cc` = \'10\') AS `b` ON `d`=`e` WHERE `x` = \'20\'', - 'prepare' => 'SELECT `a`.*, `b`.* FROM `a` INNER JOIN (SELECT `c`.* FROM `c` WHERE `cc` = ?) AS `b` ON `d`=`e` WHERE `x` = ?', - 'parameters' => ['subselect2where1' => 10, 'where2' => 20], - ], - 'Oracle' => [ - 'string' => 'SELECT "a".*, "b".* FROM "a" INNER JOIN (SELECT "c".* FROM "c" WHERE "cc" = \'10\') "b" ON "d"="e" WHERE "x" = \'20\'', - 'prepare' => 'SELECT "a".*, "b".* FROM "a" INNER JOIN (SELECT "c".* FROM "c" WHERE "cc" = ?) "b" ON "d"="e" WHERE "x" = ?', - 'parameters' => ['subselect2where1' => 10, 'where2' => 20], - ], - 'SqlServer' => [ - 'string' => 'SELECT [a].*, [b].* FROM [a] INNER JOIN (SELECT [c].* FROM [c] WHERE [cc] = \'10\') AS [b] ON [d]=[e] WHERE [x] = \'20\'', - 'prepare' => 'SELECT [a].*, [b].* FROM [a] INNER JOIN (SELECT [c].* FROM [c] WHERE [cc] = ?) AS [b] ON [d]=[e] WHERE [x] = ?', - 'parameters' => ['subselect2where1' => 10, 'where2' => 20], - ], - // @codingStandardsIgnoreEnd - ], - ], - 'Ddl::CreateTable::processColumns()' => [ - 'sqlObject' => $this->createTable('foo') - ->addColumn($this->createColumn('col1') - ->setOption('identity', true) - ->setOption('comment', 'Comment1')) - ->addColumn($this->createColumn('col2') - ->setOption('identity', true) - ->setOption('comment', 'Comment2')), - 'expected' => [ - // @codingStandardsIgnoreStart - 'sql92' => "CREATE TABLE \"foo\" ( \n \"col1\" INTEGER NOT NULL,\n \"col2\" INTEGER NOT NULL \n)", - 'MySql' => "CREATE TABLE `foo` ( \n `col1` INTEGER NOT NULL AUTO_INCREMENT COMMENT 'Comment1',\n `col2` INTEGER NOT NULL AUTO_INCREMENT COMMENT 'Comment2' \n)", - 'Oracle' => "CREATE TABLE \"foo\" ( \n \"col1\" INTEGER NOT NULL,\n \"col2\" INTEGER NOT NULL \n)", - 'SqlServer' => "CREATE TABLE [foo] ( \n [col1] INTEGER NOT NULL,\n [col2] INTEGER NOT NULL \n)", - // @codingStandardsIgnoreEnd - ], - ], - 'Ddl::CreateTable::processTable()' => [ - 'sqlObject' => $this->createTable('foo')->setTemporary(true), - 'expected' => [ - 'sql92' => "CREATE TEMPORARY TABLE \"foo\" ( \n)", - 'MySql' => "CREATE TEMPORARY TABLE `foo` ( \n)", - 'Oracle' => "CREATE TEMPORARY TABLE \"foo\" ( \n)", - 'SqlServer' => "CREATE TABLE [#foo] ( \n)", - ], - ], - 'Select::processSubSelect()' => [ - 'sqlObject' => $this->select([ - 'a' => $this->select([ - 'b' => $this->select('c')->where(['cc' => 'CC']), - ])->where(['bb' => 'BB']), - ])->where(['aa' => 'AA']), - 'expected' => [ - // @codingStandardsIgnoreStart - 'sql92' => [ - 'string' => 'SELECT "a".* FROM (SELECT "b".* FROM (SELECT "c".* FROM "c" WHERE "cc" = \'CC\') AS "b" WHERE "bb" = \'BB\') AS "a" WHERE "aa" = \'AA\'', - 'prepare' => 'SELECT "a".* FROM (SELECT "b".* FROM (SELECT "c".* FROM "c" WHERE "cc" = ?) AS "b" WHERE "bb" = ?) AS "a" WHERE "aa" = ?', - 'parameters' => ['subselect2where1' => 'CC', 'subselect1where1' => 'BB', 'where1' => 'AA'], - ], - 'MySql' => [ - 'string' => 'SELECT `a`.* FROM (SELECT `b`.* FROM (SELECT `c`.* FROM `c` WHERE `cc` = \'CC\') AS `b` WHERE `bb` = \'BB\') AS `a` WHERE `aa` = \'AA\'', - 'prepare' => 'SELECT `a`.* FROM (SELECT `b`.* FROM (SELECT `c`.* FROM `c` WHERE `cc` = ?) AS `b` WHERE `bb` = ?) AS `a` WHERE `aa` = ?', - 'parameters' => ['subselect4where1' => 'CC', 'subselect3where1' => 'BB', 'where2' => 'AA'], - ], - 'Oracle' => [ - 'string' => 'SELECT "a".* FROM (SELECT "b".* FROM (SELECT "c".* FROM "c" WHERE "cc" = \'CC\') "b" WHERE "bb" = \'BB\') "a" WHERE "aa" = \'AA\'', - 'prepare' => 'SELECT "a".* FROM (SELECT "b".* FROM (SELECT "c".* FROM "c" WHERE "cc" = ?) "b" WHERE "bb" = ?) "a" WHERE "aa" = ?', - 'parameters' => ['subselect4where1' => 'CC', 'subselect3where1' => 'BB', 'where2' => 'AA'], - ], - 'SqlServer' => [ - 'string' => 'SELECT [a].* FROM (SELECT [b].* FROM (SELECT [c].* FROM [c] WHERE [cc] = \'CC\') AS [b] WHERE [bb] = \'BB\') AS [a] WHERE [aa] = \'AA\'', - 'prepare' => 'SELECT [a].* FROM (SELECT [b].* FROM (SELECT [c].* FROM [c] WHERE [cc] = ?) AS [b] WHERE [bb] = ?) AS [a] WHERE [aa] = ?', - 'parameters' => ['subselect4where1' => 'CC', 'subselect3where1' => 'BB', 'where2' => 'AA'], - ], - // @codingStandardsIgnoreEnd - ], - ], - 'Delete::processSubSelect()' => [ - 'sqlObject' => $this->delete('foo')->where(['x' => $this->select('foo')->where(['x' => 'y'])]), - 'expected' => [ - 'sql92' => [ - 'string' => 'DELETE FROM "foo" WHERE "x" = (SELECT "foo".* FROM "foo" WHERE "x" = \'y\')', - 'prepare' => 'DELETE FROM "foo" WHERE "x" = (SELECT "foo".* FROM "foo" WHERE "x" = ?)', - 'parameters' => ['subselect1where1' => 'y'], - ], - 'MySql' => [ - 'string' => 'DELETE FROM `foo` WHERE `x` = (SELECT `foo`.* FROM `foo` WHERE `x` = \'y\')', - 'prepare' => 'DELETE FROM `foo` WHERE `x` = (SELECT `foo`.* FROM `foo` WHERE `x` = ?)', - 'parameters' => ['subselect2where1' => 'y'], - ], - 'Oracle' => [ - 'string' => 'DELETE FROM "foo" WHERE "x" = (SELECT "foo".* FROM "foo" WHERE "x" = \'y\')', - 'prepare' => 'DELETE FROM "foo" WHERE "x" = (SELECT "foo".* FROM "foo" WHERE "x" = ?)', - 'parameters' => ['subselect3where1' => 'y'], - ], - 'SqlServer' => [ - 'string' => 'DELETE FROM [foo] WHERE [x] = (SELECT [foo].* FROM [foo] WHERE [x] = \'y\')', - 'prepare' => 'DELETE FROM [foo] WHERE [x] = (SELECT [foo].* FROM [foo] WHERE [x] = ?)', - 'parameters' => ['subselect4where1' => 'y'], - ], - ], - ], - 'Update::processSubSelect()' => [ - 'sqlObject' => $this->update('foo')->set(['x' => $this->select('foo')]), - 'expected' => [ - 'sql92' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo")', - 'MySql' => 'UPDATE `foo` SET `x` = (SELECT `foo`.* FROM `foo`)', - 'Oracle' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo")', - 'SqlServer' => 'UPDATE [foo] SET [x] = (SELECT [foo].* FROM [foo])', - ], - ], - 'Insert::processSubSelect()' => [ - 'sqlObject' => $this->insert('foo')->select($this->select('foo')->where(['x' => 'y'])), - 'expected' => [ - 'sql92' => [ - 'string' => 'INSERT INTO "foo" SELECT "foo".* FROM "foo" WHERE "x" = \'y\'', - 'prepare' => 'INSERT INTO "foo" SELECT "foo".* FROM "foo" WHERE "x" = ?', - 'parameters' => ['subselect1where1' => 'y'], - ], - 'MySql' => [ - 'string' => 'INSERT INTO `foo` SELECT `foo`.* FROM `foo` WHERE `x` = \'y\'', - 'prepare' => 'INSERT INTO `foo` SELECT `foo`.* FROM `foo` WHERE `x` = ?', - 'parameters' => ['subselect2where1' => 'y'], - ], - 'Oracle' => [ - 'string' => 'INSERT INTO "foo" SELECT "foo".* FROM "foo" WHERE "x" = \'y\'', - 'prepare' => 'INSERT INTO "foo" SELECT "foo".* FROM "foo" WHERE "x" = ?', - 'parameters' => ['subselect3where1' => 'y'], - ], - 'SqlServer' => [ - 'string' => 'INSERT INTO [foo] SELECT [foo].* FROM [foo] WHERE [x] = \'y\'', - 'prepare' => 'INSERT INTO [foo] SELECT [foo].* FROM [foo] WHERE [x] = ?', - 'parameters' => ['subselect4where1' => 'y'], - ], - ], - ], - 'Update::processExpression()' => [ - 'sqlObject' => $this->update('foo')->set( - ['x' => new Sql\Expression('?', [$this->select('foo')->where(['x' => 'y'])])] - ), - 'expected' => [ - 'sql92' => [ - 'string' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo" WHERE "x" = \'y\')', - 'prepare' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo" WHERE "x" = ?)', - 'parameters' => ['subselect1where1' => 'y'], - ], - 'MySql' => [ - 'string' => 'UPDATE `foo` SET `x` = (SELECT `foo`.* FROM `foo` WHERE `x` = \'y\')', - 'prepare' => 'UPDATE `foo` SET `x` = (SELECT `foo`.* FROM `foo` WHERE `x` = ?)', - 'parameters' => ['subselect2where1' => 'y'], - ], - 'Oracle' => [ - 'string' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo" WHERE "x" = \'y\')', - 'prepare' => 'UPDATE "foo" SET "x" = (SELECT "foo".* FROM "foo" WHERE "x" = ?)', - 'parameters' => ['subselect3where1' => 'y'], - ], - 'SqlServer' => [ - 'string' => 'UPDATE [foo] SET [x] = (SELECT [foo].* FROM [foo] WHERE [x] = \'y\')', - 'prepare' => 'UPDATE [foo] SET [x] = (SELECT [foo].* FROM [foo] WHERE [x] = ?)', - 'parameters' => ['subselect4where1' => 'y'], - ], - ], - ], - 'Update::processJoins()' => [ - 'sqlObject' => $this->update('foo')->set(['x' => 'y'])->where(['xx' => 'yy'])->join( - 'bar', - 'bar.barId = foo.barId' - ), - 'expected' => [ - // @codingStandardsIgnoreStart - 'sql92' => [ - 'string' => 'UPDATE "foo" INNER JOIN "bar" ON "bar"."barId" = "foo"."barId" SET "x" = \'y\' WHERE "xx" = \'yy\'', - ], - 'MySql' => [ - 'string' => 'UPDATE `foo` INNER JOIN `bar` ON `bar`.`barId` = `foo`.`barId` SET `x` = \'y\' WHERE `xx` = \'yy\'', - ], - 'Oracle' => [ - 'string' => 'UPDATE "foo" INNER JOIN "bar" ON "bar"."barId" = "foo"."barId" SET "x" = \'y\' WHERE "xx" = \'yy\'', - ], - 'SqlServer' => [ - 'string' => 'UPDATE [foo] INNER JOIN [bar] ON [bar].[barId] = [foo].[barId] SET [x] = \'y\' WHERE [xx] = \'yy\'', - ], - // @codingStandardsIgnoreEnd - ], - ], - ]; - } - - protected function dataProviderDecorators() - { - return [ - 'RootDecorators::Select' => [ - 'sqlObject' => $this->select('foo')->where(['x' => $this->select('bar')]), - 'expected' => [ - 'sql92' => [ - 'decorators' => [ - 'Zend\Db\Sql\Select' => new TestAsset\SelectDecorator, - ], - 'string' => 'SELECT "foo".* FROM "foo" WHERE "x" = (SELECT "bar".* FROM "bar")', - ], - 'MySql' => [ - 'decorators' => [ - 'Zend\Db\Sql\Select' => new TestAsset\SelectDecorator, - ], - 'string' => 'SELECT `foo`.* FROM `foo` WHERE `x` = (SELECT `bar`.* FROM `bar`)', - ], - 'Oracle' => [ - 'decorators' => [ - 'Zend\Db\Sql\Select' => new TestAsset\SelectDecorator, - ], - 'string' => 'SELECT "foo".* FROM "foo" WHERE "x" = (SELECT "bar".* FROM "bar")', - ], - 'SqlServer' => [ - 'decorators' => [ - 'Zend\Db\Sql\Select' => new TestAsset\SelectDecorator, - ], - 'string' => 'SELECT [foo].* FROM [foo] WHERE [x] = (SELECT [bar].* FROM [bar])', - ], - ], - ], - // @codingStandardsIgnoreStart - /* TODO - should be implemented - 'RootDecorators::Insert' => array( - 'sqlObject' => $this->insert('foo')->select($this->select()), - 'expected' => array( - 'sql92' => array( - 'decorators' => array( - 'Zend\Db\Sql\Insert' => new TestAsset\InsertDecorator, // Decorator for root sqlObject - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_Sql92=}') - ), - 'string' => 'INSERT INTO "foo" {=SELECT_Sql92=}', - ), - 'MySql' => array( - 'decorators' => array( - 'Zend\Db\Sql\Insert' => new TestAsset\InsertDecorator, // Decorator for root sqlObject - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_MySql=}') - ), - 'string' => 'INSERT INTO `foo` {=SELECT_MySql=}', - ), - 'Oracle' => array( - 'decorators' => array( - 'Zend\Db\Sql\Insert' => new TestAsset\InsertDecorator, // Decorator for root sqlObject - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Oracle\SelectDecorator', '{=SELECT_Oracle=}') - ), - 'string' => 'INSERT INTO "foo" {=SELECT_Oracle=}', - ), - 'SqlServer' => array( - 'decorators' => array( - 'Zend\Db\Sql\Insert' => new TestAsset\InsertDecorator, // Decorator for root sqlObject - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\SqlServer\SelectDecorator', '{=SELECT_SqlServer=}') - ), - 'string' => 'INSERT INTO [foo] {=SELECT_SqlServer=}', - ), - ), - ), - 'RootDecorators::Delete' => array( - 'sqlObject' => $this->delete('foo')->where(array('x'=>$this->select('foo'))), - 'expected' => array( - 'sql92' => array( - 'decorators' => array( - 'Zend\Db\Sql\Delete' => new TestAsset\DeleteDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_Sql92=}') - ), - 'string' => 'DELETE FROM "foo" WHERE "x" = ({=SELECT_Sql92=})', - ), - 'MySql' => array( - 'decorators' => array( - 'Zend\Db\Sql\Delete' => new TestAsset\DeleteDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_MySql=}') - ), - 'string' => 'DELETE FROM `foo` WHERE `x` = ({=SELECT_MySql=})', - ), - 'Oracle' => array( - 'decorators' => array( - 'Zend\Db\Sql\Delete' => new TestAsset\DeleteDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Oracle\SelectDecorator', '{=SELECT_Oracle=}') - ), - 'string' => 'DELETE FROM "foo" WHERE "x" = ({=SELECT_Oracle=})', - ), - 'SqlServer' => array( - 'decorators' => array( - 'Zend\Db\Sql\Delete' => new TestAsset\DeleteDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\SqlServer\SelectDecorator', '{=SELECT_SqlServer=}') - ), - 'string' => 'DELETE FROM [foo] WHERE [x] = ({=SELECT_SqlServer=})', - ), - ), - ), - 'RootDecorators::Update' => array( - 'sqlObject' => $this->update('foo')->where(array('x'=>$this->select('foo'))), - 'expected' => array( - 'sql92' => array( - 'decorators' => array( - 'Zend\Db\Sql\Update' => new TestAsset\UpdateDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_Sql92=}') - ), - 'string' => 'UPDATE "foo" SET WHERE "x" = ({=SELECT_Sql92=})', - ), - 'MySql' => array( - 'decorators' => array( - 'Zend\Db\Sql\Update' => new TestAsset\UpdateDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_MySql=}') - ), - 'string' => 'UPDATE `foo` SET WHERE `x` = ({=SELECT_MySql=})', - ), - 'Oracle' => array( - 'decorators' => array( - 'Zend\Db\Sql\Update' => new TestAsset\UpdateDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Oracle\SelectDecorator', '{=SELECT_Oracle=}') - ), - 'string' => 'UPDATE "foo" SET WHERE "x" = ({=SELECT_Oracle=})', - ), - 'SqlServer' => array( - 'decorators' => array( - 'Zend\Db\Sql\Update' => new TestAsset\UpdateDecorator, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\SqlServer\SelectDecorator', '{=SELECT_SqlServer=}') - ), - 'string' => 'UPDATE [foo] SET WHERE [x] = ({=SELECT_SqlServer=})', - ), - ), - ), - 'DecorableExpression()' => array( - 'sqlObject' => $this->update('foo')->where(array('x'=>new Sql\Expression('?', array($this->select('foo'))))), - 'expected' => array( - 'sql92' => array( - 'decorators' => array( - 'Zend\Db\Sql\Expression' => new TestAsset\DecorableExpression, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_Sql92=}') - ), - 'string' => 'UPDATE "foo" SET WHERE "x" = {decorate-({=SELECT_Sql92=})-decorate}', - ), - 'MySql' => array( - 'decorators' => array( - 'Zend\Db\Sql\Expression' => new TestAsset\DecorableExpression, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Mysql\SelectDecorator', '{=SELECT_MySql=}') - ), - 'string' => 'UPDATE `foo` SET WHERE `x` = {decorate-({=SELECT_MySql=})-decorate}', - ), - 'Oracle' => array( - 'decorators' => array( - 'Zend\Db\Sql\Expression' => new TestAsset\DecorableExpression, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\Oracle\SelectDecorator', '{=SELECT_Oracle=}') - ), - 'string' => 'UPDATE "foo" SET WHERE "x" = {decorate-({=SELECT_Oracle=})-decorate}', - ), - 'SqlServer' => array( - 'decorators' => array( - 'Zend\Db\Sql\Expression' => new TestAsset\DecorableExpression, - 'Zend\Db\Sql\Select' => array('Zend\Db\Sql\Platform\SqlServer\SelectDecorator', '{=SELECT_SqlServer=}') - ), - 'string' => 'UPDATE [foo] SET WHERE [x] = {decorate-({=SELECT_SqlServer=})-decorate}', - ), - ), - ),*/ - // @codingStandardsIgnoreEnd - ]; - } - - public function dataProvider() - { - $data = array_merge( - $this->dataProviderCommonProcessMethods(), - $this->dataProviderDecorators() - ); - - $res = []; - foreach ($data as $index => $test) { - foreach ($test['expected'] as $platform => $expected) { - $res[$index . '->' . $platform] = [ - 'sqlObject' => $test['sqlObject'], - 'platform' => $platform, - 'expected' => $expected, - ]; - } - } - return $res; - } - - /** - * @param type $sqlObject - * @param type $platform - * @param type $expected - * @dataProvider dataProvider - */ - public function test($sqlObject, $platform, $expected) - { - $sql = new Sql\Sql($this->resolveAdapter($platform)); - - if (is_array($expected) && isset($expected['decorators'])) { - foreach ($expected['decorators'] as $type => $decorator) { - $sql->getSqlPlatform()->setTypeDecorator($type, $this->resolveDecorator($decorator)); - } - } - - $expectedString = is_string($expected) ? $expected : (isset($expected['string']) ? $expected['string'] : null); - if ($expectedString) { - $actual = $sql->getSqlStringForSqlObject($sqlObject); - self::assertEquals($expectedString, $actual, "getSqlString()"); - } - if (is_array($expected) && isset($expected['prepare'])) { - $actual = $sql->prepareStatementForSqlObject($sqlObject); - self::assertEquals($expected['prepare'], $actual->getSql(), "prepareStatement()"); - if (isset($expected['parameters'])) { - $actual = $actual->getParameterContainer()->getNamedArray(); - self::assertSame($expected['parameters'], $actual, "parameterContainer()"); - } - } - } - - protected function resolveDecorator($decorator) - { - if (is_array($decorator)) { - $decoratorMock = $this->getMockBuilder($decorator[0]) - ->setMethods(['buildSqlString']) - ->setConstructorArgs([null]) - ->getMock(); - $decoratorMock->expects($this->any())->method('buildSqlString')->will($this->returnValue($decorator[1])); - return $decoratorMock; - } - if ($decorator instanceof Sql\Platform\PlatformDecoratorInterface) { - return $decorator; - } - return; - } - - protected function resolveAdapter($platform) - { - switch ($platform) { - case 'sql92': - $platform = new TestAsset\TrustingSql92Platform(); - break; - case 'MySql': - $platform = new TestAsset\TrustingMysqlPlatform(); - break; - case 'Oracle': - $platform = new TestAsset\TrustingOraclePlatform(); - break; - case 'SqlServer': - $platform = new TestAsset\TrustingSqlServerPlatform(); - break; - default: - $platform = null; - } - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnCallback(function () { - return new Adapter\StatementContainer; - })); - - return new Adapter\Adapter($mockDriver, $platform); - } - - public function __call($name, $arguments) - { - $arg0 = isset($arguments[0]) ? $arguments[0] : null; - switch ($name) { - case 'select': - return new Sql\Select($arg0); - case 'delete': - return new Sql\Delete($arg0); - case 'update': - return new Sql\Update($arg0); - case 'insert': - return new Sql\Insert($arg0); - case 'createTable': - return new Sql\Ddl\CreateTable($arg0); - case 'createColumn': - return new Sql\Ddl\Column\Column($arg0); - } - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlTest.php deleted file mode 100644 index f38148a9..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/SqlTest.php +++ /dev/null @@ -1,237 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult)); - $mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection)); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - - // setup mock adapter - $this->mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver, new TestAsset\TrustingSql92Platform()]) - ->getMock(); - - $this->sql = new Sql($this->mockAdapter, 'foo'); - } - - /** - * @covers \Zend\Db\Sql\Sql::__construct - */ - // @codingStandardsIgnoreStart - public function test__construct() - { - // @codingStandardsIgnoreEnd - $sql = new Sql($this->mockAdapter); - - self::assertFalse($sql->hasTable()); - - $sql->setTable('foo'); - self::assertSame('foo', $sql->getTable()); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Table must be a string, array or instance of TableIdentifier.'); - $sql->setTable(null); - } - - /** - * @covers \Zend\Db\Sql\Sql::select - */ - public function testSelect() - { - $select = $this->sql->select(); - self::assertInstanceOf('Zend\Db\Sql\Select', $select); - self::assertSame('foo', $select->getRawState('table')); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'This Sql object is intended to work with only the table "foo" provided at construction time.' - ); - $this->sql->select('bar'); - } - - /** - * @covers \Zend\Db\Sql\Sql::insert - */ - public function testInsert() - { - $insert = $this->sql->insert(); - self::assertInstanceOf('Zend\Db\Sql\Insert', $insert); - self::assertSame('foo', $insert->getRawState('table')); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'This Sql object is intended to work with only the table "foo" provided at construction time.' - ); - $this->sql->insert('bar'); - } - - /** - * @covers \Zend\Db\Sql\Sql::update - */ - public function testUpdate() - { - $update = $this->sql->update(); - self::assertInstanceOf('Zend\Db\Sql\Update', $update); - self::assertSame('foo', $update->getRawState('table')); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'This Sql object is intended to work with only the table "foo" provided at construction time.' - ); - $this->sql->update('bar'); - } - - /** - * @covers \Zend\Db\Sql\Sql::delete - */ - public function testDelete() - { - $delete = $this->sql->delete(); - - self::assertInstanceOf('Zend\Db\Sql\Delete', $delete); - self::assertSame('foo', $delete->getRawState('table')); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage( - 'This Sql object is intended to work with only the table "foo" provided at construction time.' - ); - $this->sql->delete('bar'); - } - - /** - * @covers \Zend\Db\Sql\Sql::prepareStatementForSqlObject - */ - public function testPrepareStatementForSqlObject() - { - $insert = $this->sql->insert()->columns(['foo'])->values(['foo' => 'bar']); - $stmt = $this->sql->prepareStatementForSqlObject($insert); - self::assertInstanceOf('Zend\Db\Adapter\Driver\StatementInterface', $stmt); - } - - /** - * @group 6890 - */ - public function testForDifferentAdapters() - { - $adapterSql92 = $this->getAdapterForPlatform('sql92'); - $adapterMySql = $this->getAdapterForPlatform('MySql'); - $adapterOracle = $this->getAdapterForPlatform('Oracle'); - $adapterSqlServer = $this->getAdapterForPlatform('SqlServer'); - - $select = $this->sql->select()->offset(10); - - // Default - self::assertEquals( - 'SELECT "foo".* FROM "foo" OFFSET \'10\'', - $this->sql->buildSqlString($select) - ); - $this->mockAdapter->getDriver()->createStatement()->expects($this->any())->method('setSql') - ->with($this->equalTo('SELECT "foo".* FROM "foo" OFFSET ?')); - $this->sql->prepareStatementForSqlObject($select); - - // Sql92 - self::assertEquals( - 'SELECT "foo".* FROM "foo" OFFSET \'10\'', - $this->sql->buildSqlString($select, $adapterSql92) - ); - $adapterSql92->getDriver()->createStatement()->expects($this->any())->method('setSql') - ->with($this->equalTo('SELECT "foo".* FROM "foo" OFFSET ?')); - $this->sql->prepareStatementForSqlObject($select, null, $adapterSql92); - - // MySql - self::assertEquals( - 'SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET 10', - $this->sql->buildSqlString($select, $adapterMySql) - ); - $adapterMySql->getDriver()->createStatement()->expects($this->any())->method('setSql') - ->with($this->equalTo('SELECT `foo`.* FROM `foo` LIMIT 18446744073709551615 OFFSET ?')); - $this->sql->prepareStatementForSqlObject($select, null, $adapterMySql); - - // Oracle - self::assertEquals( - 'SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b ) WHERE b_rownum > (10)', - $this->sql->buildSqlString($select, $adapterOracle) - ); - // @codingStandardsIgnoreStart - $adapterOracle->getDriver()->createStatement()->expects($this->any())->method('setSql') - ->with($this->equalTo('SELECT * FROM (SELECT b.*, rownum b_rownum FROM ( SELECT "foo".* FROM "foo" ) b ) WHERE b_rownum > (:offset)')); - // @codingStandardsIgnoreEnd - $this->sql->prepareStatementForSqlObject($select, null, $adapterOracle); - - // SqlServer - self::assertContains( - 'WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN 10+1 AND 0+10', - $this->sql->buildSqlString($select, $adapterSqlServer) - ); - $adapterSqlServer->getDriver()->createStatement()->expects($this->any())->method('setSql') - ->with($this->stringContains( - 'WHERE [ZEND_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__ZEND_ROW_NUMBER] BETWEEN ?+1 AND ?+?' - )); - $this->sql->prepareStatementForSqlObject($select, null, $adapterSqlServer); - } - - /** - * Data provider - * - * @param string $platform - * - * @return Adapter - */ - protected function getAdapterForPlatform($platform) - { - switch ($platform) { - case 'sql92': - $platform = new TestAsset\TrustingSql92Platform(); - break; - case 'MySql': - $platform = new TestAsset\TrustingMysqlPlatform(); - break; - case 'Oracle': - $platform = new TestAsset\TrustingOraclePlatform(); - break; - case 'SqlServer': - $platform = new TestAsset\TrustingSqlServerPlatform(); - break; - default: - $platform = null; - } - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - - return new Adapter($mockDriver, $platform); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/TableIdentifierTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/TableIdentifierTest.php deleted file mode 100644 index b1ec4f57..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/TableIdentifierTest.php +++ /dev/null @@ -1,118 +0,0 @@ -getTable()); - } - - public function testGetDefaultSchema() - { - $tableIdentifier = new TableIdentifier('foo'); - - self::assertNull($tableIdentifier->getSchema()); - } - - public function testGetSchema() - { - $tableIdentifier = new TableIdentifier('foo', 'bar'); - - self::assertSame('bar', $tableIdentifier->getSchema()); - } - - public function testGetTableFromObjectStringCast() - { - $table = $this->getMockBuilder('stdClass')->setMethods(['__toString'])->getMock(); - - $table->expects($this->once())->method('__toString')->will($this->returnValue('castResult')); - - $tableIdentifier = new TableIdentifier($table); - - self::assertSame('castResult', $tableIdentifier->getTable()); - self::assertSame('castResult', $tableIdentifier->getTable()); - } - - public function testGetSchemaFromObjectStringCast() - { - $schema = $this->getMockBuilder('stdClass')->setMethods(['__toString'])->getMock(); - - $schema->expects($this->once())->method('__toString')->will($this->returnValue('castResult')); - - $tableIdentifier = new TableIdentifier('foo', $schema); - - self::assertSame('castResult', $tableIdentifier->getSchema()); - self::assertSame('castResult', $tableIdentifier->getSchema()); - } - - /** - * @dataProvider invalidTableProvider - * - * @param mixed $invalidTable - */ - public function testRejectsInvalidTable($invalidTable) - { - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - - new TableIdentifier($invalidTable); - } - - /** - * @dataProvider invalidSchemaProvider - * - * @param mixed $invalidSchema - */ - public function testRejectsInvalidSchema($invalidSchema) - { - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - - new TableIdentifier('foo', $invalidSchema); - } - - /** - * Data provider - * - * @return mixed[][] - */ - public function invalidTableProvider() - { - return array_merge( - [[null]], - $this->invalidSchemaProvider() - ); - } - - /** - * Data provider - * - * @return mixed[][] - */ - public function invalidSchemaProvider() - { - return [ - [''], - [new stdClass()], - [[]], - ]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/Sql/UpdateTest.php b/bundled-libs/zendframework/zend-db/test/unit/Sql/UpdateTest.php deleted file mode 100644 index 4fa6e5bd..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/Sql/UpdateTest.php +++ /dev/null @@ -1,429 +0,0 @@ -update = new Update; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\Sql\Update::table - */ - public function testTable() - { - $this->update->table('foo', 'bar'); - self::assertEquals('foo', $this->readAttribute($this->update, 'table')); - - $tableIdentifier = new TableIdentifier('foo', 'bar'); - $this->update->table($tableIdentifier); - self::assertEquals($tableIdentifier, $this->readAttribute($this->update, 'table')); - } - - /** - * @covers \Zend\Db\Sql\Update::__construct - */ - public function testConstruct() - { - $update = new Update('foo'); - self::assertEquals('foo', $this->readAttribute($update, 'table')); - } - - /** - * @covers \Zend\Db\Sql\Update::set - */ - public function testSet() - { - $this->update->set(['foo' => 'bar']); - self::assertEquals(['foo' => 'bar'], $this->update->getRawState('set')); - } - - /** - * @covers \Zend\Db\Sql\Update::set - */ - public function testSortableSet() - { - $this->update->set([ - 'two' => 'с_two', - 'three' => 'с_three', - ]); - $this->update->set(['one' => 'с_one'], 10); - - self::assertEquals( - [ - 'one' => 'с_one', - 'two' => 'с_two', - 'three' => 'с_three', - ], - $this->update->getRawState('set') - ); - } - - /** - * @covers \Zend\Db\Sql\Update::where - */ - public function testWhere() - { - $this->update->where('x = y'); - $this->update->where(['foo > ?' => 5]); - $this->update->where(['id' => 2]); - $this->update->where(['a = b'], Where::OP_OR); - $this->update->where(['c1' => null]); - $this->update->where(['c2' => [1, 2, 3]]); - $this->update->where([new \Zend\Db\Sql\Predicate\IsNotNull('c3')]); - $where = $this->update->where; - - $predicates = $this->readAttribute($where, 'predicates'); - self::assertEquals('AND', $predicates[0][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[0][1]); - - self::assertEquals('AND', $predicates[1][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Expression', $predicates[1][1]); - - self::assertEquals('AND', $predicates[2][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Operator', $predicates[2][1]); - - self::assertEquals('OR', $predicates[3][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\Literal', $predicates[3][1]); - - self::assertEquals('AND', $predicates[4][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNull', $predicates[4][1]); - - self::assertEquals('AND', $predicates[5][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\In', $predicates[5][1]); - - self::assertEquals('AND', $predicates[6][0]); - self::assertInstanceOf('Zend\Db\Sql\Predicate\IsNotNull', $predicates[6][1]); - - $where = new Where; - $this->update->where($where); - self::assertSame($where, $this->update->where); - - $this->update->where(function ($what) use ($where) { - self::assertSame($where, $what); - }); - - $this->expectException('Zend\Db\Sql\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Predicate cannot be null'); - $this->update->where(null); - } - - /** - * @group ZF2-240 - * @covers \Zend\Db\Sql\Update::where - */ - public function testPassingMultipleKeyValueInWhereClause() - { - $update = clone $this->update; - $update->table('table'); - $update->set(['fld1' => 'val1']); - $update->where(['id1' => 'val1', 'id2' => 'val2']); - self::assertEquals( - 'UPDATE "table" SET "fld1" = \'val1\' WHERE "id1" = \'val1\' AND "id2" = \'val2\'', - $update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @covers \Zend\Db\Sql\Update::getRawState - */ - public function testGetRawState() - { - $this->update->table('foo') - ->set(['bar' => 'baz']) - ->where('x = y'); - - self::assertEquals('foo', $this->update->getRawState('table')); - self::assertEquals(true, $this->update->getRawState('emptyWhereProtection')); - self::assertEquals(['bar' => 'baz'], $this->update->getRawState('set')); - self::assertInstanceOf('Zend\Db\Sql\Where', $this->update->getRawState('where')); - } - - /** - * @covers \Zend\Db\Sql\Update::prepareStatement - */ - public function testPrepareStatement() - { - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('UPDATE "foo" SET "bar" = ?, "boo" = NOW() WHERE x = y')); - - $this->update->table('foo') - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()')]) - ->where('x = y'); - - $this->update->prepareStatement($mockAdapter, $mockStatement); - - // with TableIdentifier - $this->update = new Update; - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('UPDATE "sch"."foo" SET "bar" = ?, "boo" = NOW() WHERE x = y')); - - $this->update->table(new TableIdentifier('foo', 'sch')) - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()')]) - ->where('x = y'); - - $this->update->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @covers \Zend\Db\Sql\Update::getSqlString - */ - public function testGetSqlString() - { - $this->update->table('foo') - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]) - ->where('x = y'); - - self::assertEquals( - 'UPDATE "foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - - // with TableIdentifier - $this->update = new Update; - $this->update->table(new TableIdentifier('foo', 'sch')) - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]) - ->where('x = y'); - - self::assertEquals( - 'UPDATE "sch"."foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @group 6768 - * @group 6773 - */ - public function testGetSqlStringForFalseUpdateValueParameter() - { - $this->update = new Update; - $this->update->table(new TableIdentifier('foo', 'sch')) - ->set(['bar' => false, 'boo' => 'test', 'bam' => true]) - ->where('x = y'); - self::assertEquals( - 'UPDATE "sch"."foo" SET "bar" = \'\', "boo" = \'test\', "bam" = \'1\' WHERE x = y', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @covers \Zend\Db\Sql\Update::__get - */ - public function testGetUpdate() - { - $getWhere = $this->update->__get('where'); - self::assertInstanceOf('Zend\Db\Sql\Where', $getWhere); - } - - /** - * @covers \Zend\Db\Sql\Update::__get - */ - public function testGetUpdateFails() - { - $getWhat = $this->update->__get('what'); - self::assertNull($getWhat); - } - - /** - * @covers \Zend\Db\Sql\Update::__clone - */ - public function testCloneUpdate() - { - $update1 = clone $this->update; - $update1->table('foo') - ->set(['bar' => 'baz']) - ->where('x = y'); - - $update2 = clone $this->update; - $update2->table('foo') - ->set(['bar' => 'baz']) - ->where([ - 'id = ?' => 1, - ]); - self::assertEquals( - 'UPDATE "foo" SET "bar" = \'baz\' WHERE id = \'1\'', - $update2->getSqlString(new TrustingSql92Platform) - ); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInPrepareStatement() - { - $updateIgnore = new UpdateIgnore(); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional')); - $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?')); - $mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $pContainer = new \Zend\Db\Adapter\ParameterContainer([]); - $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer)); - - $mockStatement->expects($this->at(1)) - ->method('setSql') - ->with($this->equalTo('UPDATE IGNORE "foo" SET "bar" = ?, "boo" = NOW() WHERE x = y')); - - $updateIgnore->table('foo') - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()')]) - ->where('x = y'); - - $updateIgnore->prepareStatement($mockAdapter, $mockStatement); - } - - /** - * @coversNothing - */ - public function testSpecificationconstantsCouldBeOverridedByExtensionInGetSqlString() - { - $this->update = new UpdateIgnore(); - - $this->update->table('foo') - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]) - ->where('x = y'); - - self::assertEquals( - 'UPDATE IGNORE "foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - - // with TableIdentifier - $this->update = new UpdateIgnore(); - $this->update->table(new TableIdentifier('foo', 'sch')) - ->set(['bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null]) - ->where('x = y'); - - self::assertEquals( - 'UPDATE IGNORE "sch"."foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @covers \Zend\Db\Sql\Update::where - */ - public function testJoin() - { - $this->update->table('Document'); - $this->update->set(['x' => 'y']) - ->join( - 'User', // table name - 'User.UserId = Document.UserId' // expression to join on - // default JOIN INNER - ) - ->join( - 'Category', - 'Category.CategoryId = Document.CategoryId', - Join::JOIN_LEFT // (optional), one of inner, outer, left, right - ); - - self::assertEquals( - 'UPDATE "Document" INNER JOIN "User" ON "User"."UserId" = "Document"."UserId" ' - . 'LEFT JOIN "Category" ON "Category"."CategoryId" = "Document"."CategoryId" SET "x" = \'y\'', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * Here test if we want update fields from specific table. - * Important when we're updating fields that are existing in several tables in one query. - * The same test as above but here we will specify table in update params - */ - public function testJoinMultiUpdate() - { - $this->update->table('Document'); - $this->update->set(['Documents.x' => 'y']) - ->join( - 'User', - 'User.UserId = Document.UserId' - ) - ->join( - 'Category', - 'Category.CategoryId = Document.CategoryId', - Join::JOIN_LEFT - ); - - self::assertEquals( - 'UPDATE "Document" INNER JOIN "User" ON "User"."UserId" = "Document"."UserId" ' - . 'LEFT JOIN "Category" ON "Category"."CategoryId" = "Document"."CategoryId" SET "Documents"."x" = \'y\'', - $this->update->getSqlString(new TrustingSql92Platform()) - ); - } - - /** - * @testdox unit test: Test join() returns Update object (is chainable) - * @covers \Zend\Db\Sql\Update::join - */ - public function testJoinChainable() - { - $return = $this->update->join('baz', 'foo.fooId = baz.fooId', Join::JOIN_LEFT); - self::assertSame($this->update, $return); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/AbstractTableGatewayTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/AbstractTableGatewayTest.php deleted file mode 100644 index b0d7a1c7..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/AbstractTableGatewayTest.php +++ /dev/null @@ -1,425 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockResult->expects($this->any())->method('getAffectedRows')->will($this->returnValue(5)); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult)); - - $mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $mockConnection->expects($this->any())->method('getLastGeneratedValue')->will($this->returnValue(10)); - - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection)); - - $this->mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - $this->mockSql = $this->getMockBuilder('Zend\Db\Sql\Sql') - ->setMethods(['select', 'insert', 'update', 'delete']) - ->setConstructorArgs([$this->mockAdapter, 'foo']) - ->getMock(); - $this->mockSql->expects($this->any())->method('select')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\Sql\Select') - ->setMethods(['where', 'getRawState']) - ->setConstructorArgs(['foo']) - ->getMock() - )); - $this->mockSql->expects($this->any())->method('insert')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\Sql\Insert') - ->setMethods(['prepareStatement', 'values']) - ->setConstructorArgs(['foo']) - ->getMock() - )); - $this->mockSql->expects($this->any())->method('update')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\Sql\Update') - ->setMethods(['where', 'join']) - ->setConstructorArgs(['foo']) - ->getMock() - )); - $this->mockSql->expects($this->any())->method('delete')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\Sql\Delete') - ->setMethods(['where']) - ->setConstructorArgs(['foo']) - ->getMock() - )); - - $this->mockFeatureSet = $this->getMockBuilder('Zend\Db\TableGateway\Feature\FeatureSet')->getMock(); - - $this->table = $this->getMockForAbstractClass( - 'Zend\Db\TableGateway\AbstractTableGateway' - //array('getTable') - ); - $tgReflection = new \ReflectionClass('Zend\Db\TableGateway\AbstractTableGateway'); - foreach ($tgReflection->getProperties() as $tgPropReflection) { - $tgPropReflection->setAccessible(true); - switch ($tgPropReflection->getName()) { - case 'table': - $tgPropReflection->setValue($this->table, 'foo'); - break; - case 'adapter': - $tgPropReflection->setValue($this->table, $this->mockAdapter); - break; - case 'resultSetPrototype': - $tgPropReflection->setValue($this->table, new ResultSet); - break; - case 'sql': - $tgPropReflection->setValue($this->table, $this->mockSql); - break; - case 'featureSet': - $tgPropReflection->setValue($this->table, $this->mockFeatureSet); - break; - } - } - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::getTable - */ - public function testGetTable() - { - self::assertEquals('foo', $this->table->getTable()); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::getAdapter - */ - public function testGetAdapter() - { - self::assertSame($this->mockAdapter, $this->table->getAdapter()); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::getSql - */ - public function testGetSql() - { - self::assertInstanceOf('Zend\Db\Sql\Sql', $this->table->getSql()); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::getResultSetPrototype - */ - public function testGetSelectResultPrototype() - { - self::assertInstanceOf('Zend\Db\ResultSet\ResultSet', $this->table->getResultSetPrototype()); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::select - * @covers \Zend\Db\TableGateway\AbstractTableGateway::selectWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeSelect - */ - public function testSelectWithNoWhere() - { - $resultSet = $this->table->select(); - - // check return types - self::assertInstanceOf('Zend\Db\ResultSet\ResultSet', $resultSet); - self::assertNotSame($this->table->getResultSetPrototype(), $resultSet); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::select - * @covers \Zend\Db\TableGateway\AbstractTableGateway::selectWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeSelect - */ - public function testSelectWithWhereString() - { - $mockSelect = $this->mockSql->select(); - - $mockSelect->expects($this->any()) - ->method('getRawState') - ->will($this->returnValue([ - 'table' => $this->table->getTable(), - 'columns' => [], - ])); - - // assert select::from() is called - $mockSelect->expects($this->once()) - ->method('where') - ->with($this->equalTo('foo')); - - $this->table->select('foo'); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::select - * @covers \Zend\Db\TableGateway\AbstractTableGateway::selectWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeSelect - * - * This is a test for the case when a valid $select is built using an aliased table name, then used - * with AbstractTableGateway::selectWith (or AbstractTableGateway::select). - * - * $myTable = new MyTable(...); - * $sql = new \Zend\Db\Sql\Sql(...); - * $select = $sql->select()->from(array('t' => 'mytable')); - * - * // Following fails, with Fatal error: Uncaught exception 'RuntimeException' with message - * 'The table name of the provided select object must match that of the table' unless fix is provided. - * $myTable->selectWith($select); - * - */ - public function testSelectWithArrayTable() - { - // Case 1 - - $select1 = $this->getMockBuilder('Zend\Db\Sql\Select')->setMethods(['getRawState'])->getMock(); - $select1->expects($this->once()) - ->method('getRawState') - ->will($this->returnValue([ - 'table' => 'foo', // Standard table name format, valid according to Select::from() - 'columns' => null, - ])); - $return = $this->table->selectWith($select1); - self::assertNotNull($return); - - // Case 2 - - $select1 = $this->getMockBuilder('Zend\Db\Sql\Select')->setMethods(['getRawState'])->getMock(); - $select1->expects($this->once()) - ->method('getRawState') - ->will($this->returnValue([ - 'table' => ['f' => 'foo'], // Alias table name format, valid according to Select::from() - 'columns' => null, - ])); - $return = $this->table->selectWith($select1); - self::assertNotNull($return); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::insert - * @covers \Zend\Db\TableGateway\AbstractTableGateway::insertWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeInsert - */ - public function testInsert() - { - $mockInsert = $this->mockSql->insert(); - - $mockInsert->expects($this->once()) - ->method('prepareStatement') - ->with($this->mockAdapter); - - - $mockInsert->expects($this->once()) - ->method('values') - ->with($this->equalTo(['foo' => 'bar'])); - - $affectedRows = $this->table->insert(['foo' => 'bar']); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::update - * @covers \Zend\Db\TableGateway\AbstractTableGateway::updateWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeUpdate - */ - public function testUpdate() - { - $mockUpdate = $this->mockSql->update(); - - // assert select::from() is called - $mockUpdate->expects($this->once()) - ->method('where') - ->with($this->equalTo('id = 2')); - - $affectedRows = $this->table->update(['foo' => 'bar'], 'id = 2'); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::update - * @covers \Zend\Db\TableGateway\AbstractTableGateway::updateWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeUpdate - */ - public function testUpdateWithJoin() - { - $mockUpdate = $this->mockSql->update(); - - $joins = [ - [ - 'name' => 'baz', - 'on' => 'foo.fooId = baz.fooId', - 'type' => Sql\Join::JOIN_LEFT, - ], - ]; - - // assert select::from() is called - $mockUpdate->expects($this->once()) - ->method('where') - ->with($this->equalTo('id = 2')); - - $mockUpdate->expects($this->once()) - ->method('join') - ->with($joins[0]['name'], $joins[0]['on'], $joins[0]['type']); - - $affectedRows = $this->table->update(['foo.field' => 'bar'], 'id = 2', $joins); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::update - * @covers \Zend\Db\TableGateway\AbstractTableGateway::updateWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeUpdate - */ - public function testUpdateWithJoinDefaultType() - { - $mockUpdate = $this->mockSql->update(); - - $joins = [ - [ - 'name' => 'baz', - 'on' => 'foo.fooId = baz.fooId', - ], - ]; - - // assert select::from() is called - $mockUpdate->expects($this->once()) - ->method('where') - ->with($this->equalTo('id = 2')); - - $mockUpdate->expects($this->once()) - ->method('join') - ->with($joins[0]['name'], $joins[0]['on'], Sql\Join::JOIN_INNER); - - $affectedRows = $this->table->update(['foo.field' => 'bar'], 'id = 2', $joins); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::update - * @covers \Zend\Db\TableGateway\AbstractTableGateway::updateWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeUpdate - */ - public function testUpdateWithNoCriteria() - { - $mockUpdate = $this->mockSql->update(); - - $affectedRows = $this->table->update(['foo' => 'bar']); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::delete - * @covers \Zend\Db\TableGateway\AbstractTableGateway::deleteWith - * @covers \Zend\Db\TableGateway\AbstractTableGateway::executeDelete - */ - public function testDelete() - { - $mockDelete = $this->mockSql->delete(); - - // assert select::from() is called - $mockDelete->expects($this->once()) - ->method('where') - ->with($this->equalTo('foo')); - - $affectedRows = $this->table->delete('foo'); - self::assertEquals(5, $affectedRows); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::getLastInsertValue - */ - public function testGetLastInsertValue() - { - $this->table->insert(['foo' => 'bar']); - self::assertEquals(10, $this->table->getLastInsertValue()); - } - - public function testInitializeBuildsAResultSet() - { - $stub = $this->getMockForAbstractClass(AbstractTableGateway::class); - - $tgReflection = new \ReflectionClass('Zend\Db\TableGateway\AbstractTableGateway'); - foreach ($tgReflection->getProperties() as $tgPropReflection) { - $tgPropReflection->setAccessible(true); - switch ($tgPropReflection->getName()) { - case 'table': - $tgPropReflection->setValue($stub, 'foo'); - break; - case 'adapter': - $tgPropReflection->setValue($stub, $this->mockAdapter); - break; - case 'featureSet': - $tgPropReflection->setValue($stub, $this->mockFeatureSet); - break; - } - } - - $stub->initialize(); - $this->assertInstanceOf(ResultSet::class, $stub->getResultSetPrototype()); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::__get - */ - // @codingStandardsIgnoreStart - public function test__get() - { - // @codingStandardsIgnoreEnd - $this->table->insert(['foo']); // trigger last insert id update - - self::assertEquals(10, $this->table->lastInsertValue); - self::assertSame($this->mockAdapter, $this->table->adapter); - //self::assertEquals('foo', $this->table->table); - } - - /** - * @covers \Zend\Db\TableGateway\AbstractTableGateway::__clone - */ - // @codingStandardsIgnoreStart - public function test__clone() - { - // @codingStandardsIgnoreEnd - $cTable = clone $this->table; - self::assertSame($this->mockAdapter, $cTable->getAdapter()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/EventFeatureTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/EventFeatureTest.php deleted file mode 100644 index 93c7cda3..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/EventFeatureTest.php +++ /dev/null @@ -1,246 +0,0 @@ -eventManager = new EventManager; - $this->event = new EventFeature\TableGatewayEvent(); - $this->feature = new EventFeature($this->eventManager, $this->event); - $this->tableGateway = $this->getMockForAbstractClass('Zend\Db\TableGateway\TableGateway', [], '', false); - $this->feature->setTableGateway($this->tableGateway); - - // typically runs before everything else - $this->feature->preInitialize(); - } - - public function testGetEventManager() - { - self::assertSame($this->eventManager, $this->feature->getEventManager()); - } - - public function testGetEvent() - { - self::assertSame($this->event, $this->feature->getEvent()); - } - - public function testPreInitialize() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_PRE_INITIALIZE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->preInitialize(); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_PRE_INITIALIZE, $event->getName()); - } - - public function testPostInitialize() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_POST_INITIALIZE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->postInitialize(); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_POST_INITIALIZE, $event->getName()); - } - - public function testPreSelect() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_PRE_SELECT, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->preSelect($select = $this->getMockBuilder('Zend\Db\Sql\Select')->getMock()); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_PRE_SELECT, $event->getName()); - self::assertSame($select, $event->getParam('select')); - } - - public function testPostSelect() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_POST_SELECT, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->postSelect( - ($stmt = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock()), - ($result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock()), - ($resultset = $this->getMockBuilder('Zend\Db\ResultSet\ResultSet')->getMock()) - ); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_POST_SELECT, $event->getName()); - self::assertSame($stmt, $event->getParam('statement')); - self::assertSame($result, $event->getParam('result')); - self::assertSame($resultset, $event->getParam('result_set')); - } - - public function testPreInsert() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_PRE_INSERT, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->preInsert($insert = $this->getMockBuilder('Zend\Db\Sql\Insert')->getMock()); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_PRE_INSERT, $event->getName()); - self::assertSame($insert, $event->getParam('insert')); - } - - public function testPostInsert() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_POST_INSERT, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->postInsert( - ($stmt = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock()), - ($result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock()) - ); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_POST_INSERT, $event->getName()); - self::assertSame($stmt, $event->getParam('statement')); - self::assertSame($result, $event->getParam('result')); - } - - public function testPreUpdate() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_PRE_UPDATE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->preUpdate($update = $this->getMockBuilder('Zend\Db\Sql\Update')->getMock()); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_PRE_UPDATE, $event->getName()); - self::assertSame($update, $event->getParam('update')); - } - - public function testPostUpdate() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_POST_UPDATE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->postUpdate( - ($stmt = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock()), - ($result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock()) - ); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_POST_UPDATE, $event->getName()); - self::assertSame($stmt, $event->getParam('statement')); - self::assertSame($result, $event->getParam('result')); - } - - public function testPreDelete() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_PRE_DELETE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->preDelete($delete = $this->getMockBuilder('Zend\Db\Sql\Delete')->getMock()); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_PRE_DELETE, $event->getName()); - self::assertSame($delete, $event->getParam('delete')); - } - - public function testPostDelete() - { - $closureHasRun = false; - - /** @var $event EventFeature\TableGatewayEvent */ - $event = null; - $this->eventManager->attach(EventFeature::EVENT_POST_DELETE, function ($e) use (&$closureHasRun, &$event) { - $event = $e; - $closureHasRun = true; - }); - - $this->feature->postDelete( - ($stmt = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock()), - ($result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock()) - ); - self::assertTrue($closureHasRun); - self::assertInstanceOf('Zend\Db\TableGateway\TableGateway', $event->getTarget()); - self::assertEquals(EventFeature::EVENT_POST_DELETE, $event->getName()); - self::assertSame($stmt, $event->getParam('statement')); - self::assertSame($result, $event->getParam('result')); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/FeatureSetTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/FeatureSetTest.php deleted file mode 100644 index ea6da2ef..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/FeatureSetTest.php +++ /dev/null @@ -1,176 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\AdapterInterface')->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue( - $mockStatement - )); - $mockMasterAdapter->expects($this->any())->method('getDriver')->will($this->returnValue($mockDriver)); - $mockMasterAdapter->expects($this->any())->method('getPlatform')->will($this->returnValue( - new \Zend\Db\Adapter\Platform\Sql92() - )); - - $mockSlaveAdapter = $this->getMockBuilder('Zend\Db\Adapter\AdapterInterface')->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue( - $mockStatement - )); - $mockSlaveAdapter->expects($this->any())->method('getDriver')->will($this->returnValue($mockDriver)); - $mockSlaveAdapter->expects($this->any())->method('getPlatform')->will($this->returnValue( - new \Zend\Db\Adapter\Platform\Sql92() - )); - - $tableGatewayMock = $this->getMockForAbstractClass('Zend\Db\TableGateway\AbstractTableGateway'); - - //feature doesn't have tableGateway, but FeatureSet has - $feature = new MasterSlaveFeature($mockSlaveAdapter); - - $featureSet = new FeatureSet; - $featureSet->setTableGateway($tableGatewayMock); - - self::assertInstanceOf('Zend\Db\TableGateway\Feature\FeatureSet', $featureSet->addFeature($feature)); - } - - /** - * @cover FeatureSet::addFeature - * @group ZF2-4993 - */ - public function testAddFeatureThatFeatureHasTableGatewayButFeatureSetDoesNotHave() - { - $tableGatewayMock = $this->getMockForAbstractClass('Zend\Db\TableGateway\AbstractTableGateway'); - - $metadataMock = $this->getMockBuilder('Zend\Db\Metadata\MetadataInterface')->getMock(); - $metadataMock->expects($this->any())->method('getColumnNames')->will($this->returnValue(['id', 'name'])); - - $constraintObject = new ConstraintObject('id_pk', 'table'); - $constraintObject->setColumns(['id']); - $constraintObject->setType('PRIMARY KEY'); - - $metadataMock->expects($this->any())->method('getConstraints')->will($this->returnValue([$constraintObject])); - - //feature have tableGateway, but FeatureSet doesn't has - $feature = new MetadataFeature($metadataMock); - $feature->setTableGateway($tableGatewayMock); - - $featureSet = new FeatureSet; - self::assertInstanceOf('Zend\Db\TableGateway\Feature\FeatureSet', $featureSet->addFeature($feature)); - } - - /** - * @covers \Zend\Db\TableGateway\Feature\FeatureSet::canCallMagicCall - */ - public function testCanCallMagicCallReturnsTrueForAddedMethodOfAddedFeature() - { - $feature = new SequenceFeature('id', 'table_sequence'); - $featureSet = new FeatureSet; - $featureSet->addFeature($feature); - - self::assertTrue( - $featureSet->canCallMagicCall('lastSequenceId'), - "Should have been able to call lastSequenceId from the Sequence Feature" - ); - } - - /** - * @covers \Zend\Db\TableGateway\Feature\FeatureSet::canCallMagicCall - */ - public function testCanCallMagicCallReturnsFalseForAddedMethodOfAddedFeature() - { - $feature = new SequenceFeature('id', 'table_sequence'); - $featureSet = new FeatureSet; - $featureSet->addFeature($feature); - - self::assertFalse( - $featureSet->canCallMagicCall('postInitialize'), - "Should have been able to call postInitialize from the MetaData Feature" - ); - } - - /** - * @covers \Zend\Db\TableGateway\Feature\FeatureSet::canCallMagicCall - */ - public function testCanCallMagicCallReturnsFalseWhenNoFeaturesHaveBeenAdded() - { - $featureSet = new FeatureSet; - self::assertFalse( - $featureSet->canCallMagicCall('lastSequenceId') - ); - } - - /** - * @covers \Zend\Db\TableGateway\Feature\FeatureSet::callMagicCall - */ - public function testCallMagicCallSucceedsForValidMethodOfAddedFeature() - { - $sequenceName = 'table_sequence'; - - $platformMock = $this->getMockBuilder('Zend\Db\Adapter\Platform\Postgresql')->getMock(); - $platformMock->expects($this->any()) - ->method('getName')->will($this->returnValue('PostgreSQL')); - - $resultMock = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pgsql\Result')->getMock(); - $resultMock->expects($this->any()) - ->method('current') - ->will($this->returnValue(['currval' => 1])); - - $statementMock = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $statementMock->expects($this->any()) - ->method('prepare') - ->with('SELECT CURRVAL(\'' . $sequenceName . '\')'); - $statementMock->expects($this->any()) - ->method('execute') - ->will($this->returnValue($resultMock)); - - $adapterMock = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->disableOriginalConstructor() - ->getMock(); - $adapterMock->expects($this->any()) - ->method('getPlatform')->will($this->returnValue($platformMock)); - $adapterMock->expects($this->any()) - ->method('createStatement')->will($this->returnValue($statementMock)); - - $tableGatewayMock = $this->getMockBuilder('Zend\Db\TableGateway\AbstractTableGateway') - ->disableOriginalConstructor() - ->getMock(); - - $reflectionClass = new ReflectionClass('Zend\Db\TableGateway\AbstractTableGateway'); - $reflectionProperty = $reflectionClass->getProperty('adapter'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($tableGatewayMock, $adapterMock); - - $feature = new SequenceFeature('id', 'table_sequence'); - $feature->setTableGateway($tableGatewayMock); - $featureSet = new FeatureSet; - $featureSet->addFeature($feature); - self::assertEquals(1, $featureSet->callMagicCall('lastSequenceId', null)); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MasterSlaveFeatureTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MasterSlaveFeatureTest.php deleted file mode 100644 index e1cedb8c..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MasterSlaveFeatureTest.php +++ /dev/null @@ -1,101 +0,0 @@ -mockMasterAdapter = $this->getMockBuilder('Zend\Db\Adapter\AdapterInterface')->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue( - $mockStatement - )); - $this->mockMasterAdapter->expects($this->any())->method('getDriver')->will($this->returnValue($mockDriver)); - $this->mockMasterAdapter->expects($this->any())->method('getPlatform')->will($this->returnValue( - new \Zend\Db\Adapter\Platform\Sql92() - )); - - $this->mockSlaveAdapter = $this->getMockBuilder('Zend\Db\Adapter\AdapterInterface')->getMock(); - - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue( - $mockStatement - )); - $this->mockSlaveAdapter->expects($this->any())->method('getDriver')->will($this->returnValue($mockDriver)); - $this->mockSlaveAdapter->expects($this->any())->method('getPlatform')->will($this->returnValue( - new \Zend\Db\Adapter\Platform\Sql92() - )); - - $this->feature = new MasterSlaveFeature($this->mockSlaveAdapter); - } - - public function testPostInitialize() - { - /** @var $table \Zend\Db\TableGateway\TableGateway */ - $this->getMockForAbstractClass( - 'Zend\Db\TableGateway\TableGateway', - ['foo', $this->mockMasterAdapter, $this->feature] - ); - // postInitialize is run - self::assertSame($this->mockSlaveAdapter, $this->feature->getSlaveSql()->getAdapter()); - } - - public function testPreSelect() - { - $table = $this->getMockForAbstractClass( - 'Zend\Db\TableGateway\TableGateway', - ['foo', $this->mockMasterAdapter, $this->feature] - ); - - $this->mockSlaveAdapter->getDriver()->createStatement() - ->expects($this->once())->method('execute')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\ResultSet\ResultSet')->getMock() - )); - $table->select('foo = bar'); - } - - public function testPostSelect() - { - $table = $this->getMockForAbstractClass( - 'Zend\Db\TableGateway\TableGateway', - ['foo', $this->mockMasterAdapter, $this->feature] - ); - $this->mockSlaveAdapter->getDriver()->createStatement() - ->expects($this->once())->method('execute')->will($this->returnValue( - $this->getMockBuilder('Zend\Db\ResultSet\ResultSet')->getMock() - )); - - $masterSql = $table->getSql(); - $table->select('foo = bar'); - - // test that the sql object is restored - self::assertSame($masterSql, $table->getSql()); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MetadataFeatureTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MetadataFeatureTest.php deleted file mode 100644 index 8c6c5290..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/MetadataFeatureTest.php +++ /dev/null @@ -1,125 +0,0 @@ -getMockForAbstractClass('Zend\Db\TableGateway\AbstractTableGateway'); - $metadataMock = $this->getMockBuilder('Zend\Db\Metadata\MetadataInterface')->getMock(); - $metadataMock->expects($this->any())->method('getColumnNames')->will($this->returnValue(['id', 'name'])); - - $constraintObject = new ConstraintObject('id_pk', 'table'); - $constraintObject->setColumns(['id']); - $constraintObject->setType('PRIMARY KEY'); - - $metadataMock->expects($this->any())->method('getConstraints')->will($this->returnValue([$constraintObject])); - - $feature = new MetadataFeature($metadataMock); - $feature->setTableGateway($tableGatewayMock); - $feature->postInitialize(); - - self::assertEquals(['id', 'name'], $tableGatewayMock->getColumns()); - } - - public function testPostInitializeRecordsPrimaryKeyColumnToSharedMetadata() - { - /** @var AbstractTableGateway $tableGatewayMock */ - $tableGatewayMock = $this->getMockForAbstractClass(AbstractTableGateway::class); - $metadataMock = $this->getMockBuilder(MetadataInterface::class)->getMock(); - $metadataMock->expects($this->any())->method('getColumnNames')->will($this->returnValue(['id', 'name'])); - $metadataMock->expects($this->any()) - ->method('getTable') - ->will($this->returnValue(new TableObject('foo'))); - - - $constraintObject = new ConstraintObject('id_pk', 'table'); - $constraintObject->setColumns(['id']); - $constraintObject->setType('PRIMARY KEY'); - - $metadataMock->expects($this->any())->method('getConstraints')->will($this->returnValue([$constraintObject])); - - $feature = new MetadataFeature($metadataMock); - $feature->setTableGateway($tableGatewayMock); - $feature->postInitialize(); - - $r = new ReflectionProperty(MetadataFeature::class, 'sharedData'); - $r->setAccessible(true); - $sharedData = $r->getValue($feature); - - self::assertTrue( - isset($sharedData['metadata']['primaryKey']), - 'Shared data must have metadata entry for primary key' - ); - self::assertSame($sharedData['metadata']['primaryKey'], 'id'); - } - - public function testPostInitializeRecordsListOfColumnsInPrimaryKeyToSharedMetadata() - { - /** @var AbstractTableGateway $tableGatewayMock */ - $tableGatewayMock = $this->getMockForAbstractClass(AbstractTableGateway::class); - $metadataMock = $this->getMockBuilder(MetadataInterface::class)->getMock(); - $metadataMock->expects($this->any())->method('getColumnNames')->will($this->returnValue(['id', 'name'])); - $metadataMock->expects($this->any()) - ->method('getTable') - ->will($this->returnValue(new TableObject('foo'))); - - - $constraintObject = new ConstraintObject('id_pk', 'table'); - $constraintObject->setColumns(['composite', 'id']); - $constraintObject->setType('PRIMARY KEY'); - - $metadataMock->expects($this->any())->method('getConstraints')->will($this->returnValue([$constraintObject])); - - $feature = new MetadataFeature($metadataMock); - $feature->setTableGateway($tableGatewayMock); - $feature->postInitialize(); - - $r = new ReflectionProperty(MetadataFeature::class, 'sharedData'); - $r->setAccessible(true); - $sharedData = $r->getValue($feature); - - self::assertTrue( - isset($sharedData['metadata']['primaryKey']), - 'Shared data must have metadata entry for primary key' - ); - self::assertEquals($sharedData['metadata']['primaryKey'], ['composite', 'id']); - } - - public function testPostInitializeSkipsPrimaryKeyCheckIfNotTable() - { - /** @var AbstractTableGateway $tableGatewayMock */ - $tableGatewayMock = $this->getMockForAbstractClass(AbstractTableGateway::class); - $metadataMock = $this->getMockBuilder(MetadataInterface::class)->getMock(); - $metadataMock->expects($this->any())->method('getColumnNames')->will($this->returnValue(['id', 'name'])); - $metadataMock->expects($this->any()) - ->method('getTable') - ->will($this->returnValue(new ViewObject('foo'))); - - $metadataMock->expects($this->never())->method('getConstraints'); - - $feature = new MetadataFeature($metadataMock); - $feature->setTableGateway($tableGatewayMock); - $feature->postInitialize(); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/SequenceFeatureTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/SequenceFeatureTest.php deleted file mode 100644 index 932362e0..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/Feature/SequenceFeatureTest.php +++ /dev/null @@ -1,98 +0,0 @@ -feature = new SequenceFeature($this->primaryKeyField, $this->sequenceName); - } - - /** - * @dataProvider nextSequenceIdProvider - */ - public function testNextSequenceId($platformName, $statementSql) - { - $platform = $this->getMockForAbstractClass('Zend\Db\Adapter\Platform\PlatformInterface', ['getName']); - $platform->expects($this->any()) - ->method('getName') - ->will($this->returnValue($platformName)); - $platform->expects($this->any()) - ->method('quoteIdentifier') - ->will($this->returnValue($this->sequenceName)); - $adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods(['getPlatform', 'createStatement']) - ->disableOriginalConstructor() - ->getMock(); - $adapter->expects($this->any()) - ->method('getPlatform') - ->will($this->returnValue($platform)); - $result = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\ResultInterface', - [], - '', - false, - true, - true, - ['current'] - ); - $result->expects($this->any()) - ->method('current') - ->will($this->returnValue(['nextval' => 2])); - $statement = $this->getMockForAbstractClass( - 'Zend\Db\Adapter\Driver\StatementInterface', - [], - '', - false, - true, - true, - ['prepare', 'execute'] - ); - $statement->expects($this->any()) - ->method('execute') - ->will($this->returnValue($result)); - $statement->expects($this->any()) - ->method('prepare') - ->with($statementSql); - $adapter->expects($this->once()) - ->method('createStatement') - ->will($this->returnValue($statement)); - $this->tableGateway = $this->getMockForAbstractClass( - 'Zend\Db\TableGateway\TableGateway', - ['table', $adapter], - '', - true - ); - $this->feature->setTableGateway($this->tableGateway); - $this->feature->nextSequenceId(); - } - - public function nextSequenceIdProvider() - { - return [['PostgreSQL', 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'], - ['Oracle', 'SELECT ' . $this->sequenceName . '.NEXTVAL as "nextval" FROM dual']]; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/TableGatewayTest.php b/bundled-libs/zendframework/zend-db/test/unit/TableGateway/TableGatewayTest.php deleted file mode 100644 index b402cdd6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TableGateway/TableGatewayTest.php +++ /dev/null @@ -1,263 +0,0 @@ -getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface')->getMock(); - $mockStatement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface')->getMock(); - $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult)); - $mockConnection = $this->getMockBuilder('Zend\Db\Adapter\Driver\ConnectionInterface')->getMock(); - $mockDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\DriverInterface')->getMock(); - $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement)); - $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection)); - - // setup mock adapter - $this->mockAdapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter') - ->setMethods() - ->setConstructorArgs([$mockDriver]) - ->getMock(); - } - - /** - * Beside other tests checks for plain string table identifier - */ - public function testConstructor() - { - // constructor with only required args - $table = new TableGateway( - 'foo', - $this->mockAdapter - ); - - self::assertEquals('foo', $table->getTable()); - self::assertSame($this->mockAdapter, $table->getAdapter()); - self::assertInstanceOf('Zend\Db\TableGateway\Feature\FeatureSet', $table->getFeatureSet()); - self::assertInstanceOf('Zend\Db\ResultSet\ResultSet', $table->getResultSetPrototype()); - self::assertInstanceOf('Zend\Db\Sql\Sql', $table->getSql()); - - // injecting all args - $table = new TableGateway( - 'foo', - $this->mockAdapter, - $featureSet = new Feature\FeatureSet, - $resultSet = new ResultSet, - $sql = new Sql($this->mockAdapter, 'foo') - ); - - self::assertEquals('foo', $table->getTable()); - self::assertSame($this->mockAdapter, $table->getAdapter()); - self::assertSame($featureSet, $table->getFeatureSet()); - self::assertSame($resultSet, $table->getResultSetPrototype()); - self::assertSame($sql, $table->getSql()); - - // constructor expects exception - $this->expectException('Zend\Db\TableGateway\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('Table name must be a string or an instance of Zend\Db\Sql\TableIdentifier'); - new TableGateway( - null, - $this->mockAdapter - ); - } - - /** - * @group 6726 - * @group 6740 - */ - public function testTableAsString() - { - $ti = 'fooTable.barSchema'; - // constructor with only required args - $table = new TableGateway( - $ti, - $this->mockAdapter - ); - - self::assertEquals($ti, $table->getTable()); - } - - /** - * @group 6726 - * @group 6740 - */ - public function testTableAsTableIdentifierObject() - { - $ti = new TableIdentifier('fooTable', 'barSchema'); - // constructor with only required args - $table = new TableGateway( - $ti, - $this->mockAdapter - ); - - self::assertEquals($ti, $table->getTable()); - } - - /** - * @group 6726 - * @group 6740 - */ - public function testTableAsAliasedTableIdentifierObject() - { - $aliasedTI = ['foo' => new TableIdentifier('fooTable', 'barSchema')]; - // constructor with only required args - $table = new TableGateway( - $aliasedTI, - $this->mockAdapter - ); - - self::assertEquals($aliasedTI, $table->getTable()); - } - - public function aliasedTables() - { - $identifier = new TableIdentifier('Users'); - return [ - 'simple-alias' => [['U' => 'Users'], 'Users'], - 'identifier-alias' => [['U' => $identifier], $identifier], - ]; - } - - /** - * @group 7311 - * @dataProvider aliasedTables - */ - public function testInsertShouldResetTableToUnaliasedTable($tableValue, $expected) - { - $insert = new Insert(); - $insert->into($tableValue); - - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface') - ->getMock(); - $result->expects($this->once()) - ->method('getAffectedRows') - ->will($this->returnValue(1)); - - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface') - ->getMock(); - $statement->expects($this->once()) - ->method('execute') - ->will($this->returnValue($result)); - - $statementExpectation = function ($insert) use ($expected, $statement) { - $state = $insert->getRawState(); - self::assertSame($expected, $state['table']); - return $statement; - }; - - $sql = $this->getMockBuilder('Zend\Db\Sql\Sql') - ->disableOriginalConstructor() - ->getMock(); - $sql->expects($this->atLeastOnce()) - ->method('getTable') - ->will($this->returnValue($tableValue)); - $sql->expects($this->once()) - ->method('insert') - ->will($this->returnValue($insert)); - $sql->expects($this->once()) - ->method('prepareStatementForSqlObject') - ->with($this->equalTo($insert)) - ->will($this->returnCallback($statementExpectation)); - - $table = new TableGateway( - $tableValue, - $this->mockAdapter, - null, - null, - $sql - ); - - $result = $table->insert([ - 'foo' => 'FOO', - ]); - - $state = $insert->getRawState(); - self::assertInternalType('array', $state['table']); - self::assertEquals( - $tableValue, - $state['table'] - ); - } - - /** - * @dataProvider aliasedTables - */ - public function testUpdateShouldResetTableToUnaliasedTable($tableValue, $expected) - { - $update = new Update(); - $update->table($tableValue); - - $result = $this->getMockBuilder('Zend\Db\Adapter\Driver\ResultInterface') - ->getMock(); - $result->expects($this->once()) - ->method('getAffectedRows') - ->will($this->returnValue(1)); - - $statement = $this->getMockBuilder('Zend\Db\Adapter\Driver\StatementInterface') - ->getMock(); - $statement->expects($this->once()) - ->method('execute') - ->will($this->returnValue($result)); - - $statementExpectation = function ($update) use ($expected, $statement) { - $state = $update->getRawState(); - self::assertSame($expected, $state['table']); - return $statement; - }; - - $sql = $this->getMockBuilder('Zend\Db\Sql\Sql') - ->disableOriginalConstructor() - ->getMock(); - $sql->expects($this->atLeastOnce()) - ->method('getTable') - ->will($this->returnValue($tableValue)); - $sql->expects($this->once()) - ->method('update') - ->will($this->returnValue($update)); - $sql->expects($this->once()) - ->method('prepareStatementForSqlObject') - ->with($this->equalTo($update)) - ->will($this->returnCallback($statementExpectation)); - - $table = new TableGateway( - $tableValue, - $this->mockAdapter, - null, - null, - $sql - ); - - $result = $table->update([ - 'foo' => 'FOO', - ], [ - 'bar' => 'BAR', - ]); - - $state = $update->getRawState(); - self::assertInternalType('array', $state['table']); - self::assertEquals( - $tableValue, - $state['table'] - ); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/ConnectionWrapper.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/ConnectionWrapper.php deleted file mode 100644 index 953a6e58..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/ConnectionWrapper.php +++ /dev/null @@ -1,28 +0,0 @@ -resource = new PdoStubDriver('foo', 'bar', 'baz'); - } - - public function getNestedTransactionsCount() - { - return $this->nestedTransactionsCount; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteDecorator.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteDecorator.php deleted file mode 100644 index 5678dcfd..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteDecorator.php +++ /dev/null @@ -1,27 +0,0 @@ -subject = $subject; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteIgnore.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteIgnore.php deleted file mode 100644 index d082e5fa..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/DeleteIgnore.php +++ /dev/null @@ -1,26 +0,0 @@ - 'DELETE IGNORE FROM %1$s', - self::SPECIFICATION_WHERE => 'WHERE %1$s', - ]; - - protected function processdeleteIgnore( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return parent::processDelete($platform, $driver, $parameterContainer); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/InsertDecorator.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/InsertDecorator.php deleted file mode 100644 index 233072ad..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/InsertDecorator.php +++ /dev/null @@ -1,27 +0,0 @@ -subject = $subject; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/PdoStubDriver.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/PdoStubDriver.php deleted file mode 100644 index 886324f6..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/PdoStubDriver.php +++ /dev/null @@ -1,24 +0,0 @@ - 'REPLACE INTO %1$s (%2$s) VALUES (%3$s)', - self::SPECIFICATION_SELECT => 'REPLACE INTO %1$s %2$s %3$s', - ]; - - protected function processreplace( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return parent::processInsert($platform, $driver, $parameterContainer); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/SelectDecorator.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/SelectDecorator.php deleted file mode 100644 index ee47e01b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/SelectDecorator.php +++ /dev/null @@ -1,27 +0,0 @@ -subject = $subject; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TemporaryResultSet.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TemporaryResultSet.php deleted file mode 100644 index 2721478f..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TemporaryResultSet.php +++ /dev/null @@ -1,7 +0,0 @@ -quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingOraclePlatform.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingOraclePlatform.php deleted file mode 100644 index b003719b..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingOraclePlatform.php +++ /dev/null @@ -1,20 +0,0 @@ -quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSql92Platform.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSql92Platform.php deleted file mode 100644 index 53725fb8..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSql92Platform.php +++ /dev/null @@ -1,23 +0,0 @@ -quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSqlServerPlatform.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSqlServerPlatform.php deleted file mode 100644 index 0f4bf957..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/TrustingSqlServerPlatform.php +++ /dev/null @@ -1,20 +0,0 @@ -quoteTrustedValue($value); - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateDecorator.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateDecorator.php deleted file mode 100644 index 5e52a736..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateDecorator.php +++ /dev/null @@ -1,27 +0,0 @@ -subject = $subject; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateIgnore.php b/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateIgnore.php deleted file mode 100644 index 92a743b2..00000000 --- a/bundled-libs/zendframework/zend-db/test/unit/TestAsset/UpdateIgnore.php +++ /dev/null @@ -1,27 +0,0 @@ - 'UPDATE IGNORE %1$s', - self::SPECIFICATION_SET => 'SET %1$s', - self::SPECIFICATION_WHERE => 'WHERE %1$s', - ]; - - protected function processupdateIgnore( - PlatformInterface $platform, - DriverInterface $driver = null, - ParameterContainer $parameterContainer = null - ) { - return parent::processUpdate($platform, $driver, $parameterContainer); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/CHANGELOG.md b/bundled-libs/zendframework/zend-stdlib/CHANGELOG.md deleted file mode 100644 index 26c5e792..00000000 --- a/bundled-libs/zendframework/zend-stdlib/CHANGELOG.md +++ /dev/null @@ -1,385 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file, in reverse chronological order by release. - -## 3.2.1 - 2018-08-28 - -### Added - -- Nothing. - -### Changed - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#92](https://github.com/zendframework/zend-stdlib/pull/92) fixes serialization of `SplPriorityQueue` by ensuring its `$serial` - property is also serialized. - -- [#91](https://github.com/zendframework/zend-stdlib/pull/91) fixes behavior in the `ArrayObject` implementation that was not - compatible with PHP 7.3. - -## 3.2.0 - 2018-04-30 - -### Added - -- [#87](https://github.com/zendframework/zend-stdlib/pull/87) adds support for PHP 7.2. - -### Changed - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- [#87](https://github.com/zendframework/zend-stdlib/pull/87) removes support for HHVM. - -### Fixed - -- Nothing. - -## 3.1.1 - 2018-04-12 - -### Added - -- Nothing. - -### Changed - -- [#67](https://github.com/zendframework/zend-stdlib/pull/67) changes the typehint of the `$content` property - of the `Message` class to indicate it is a string. All known implementations - already assumed this. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an issue whereby calling `remove()` would - incorrectly re-calculate the maximum priority stored in the queue. - -- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an infinite loop condition that can occur when - inserting an item at 0 priority. - -## 3.1.0 - 2016-09-13 - -### Added - -- [#63](https://github.com/zendframework/zend-stdlib/pull/63) adds a new - `Zend\Stdlib\ConsoleHelper` class, providing minimal support for writing - output to `STDOUT` and `STDERR`, with optional colorization, when the console - supports that feature. - -### Deprecated - -- [#38](https://github.com/zendframework/zend-stdlib/pull/38) deprecates - `Zend\Stdlib\JsonSerializable`, as all supported version of PHP now support - it. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 3.0.1 - 2016-04-12 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#59](https://github.com/zendframework/zend-stdlib/pull/59) fixes a notice - when defining the `Zend\Json\Json::GLOB_BRACE` constant on systems using - non-gcc glob implementations. - -## 3.0.0 - 2016-02-03 - -### Added - -- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds PHP 7 as a - supported PHP version. -- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds a migration - document from v2 to v3. Hint: if you use hydrators, you need to be using - zend-hydrator instead! -- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds automated - documentation builds to gh-pages. - -### Deprecated - -- Nothing. - -### Removed - -- [#33](https://github.com/zendframework/zend-stdlib/pull/33) - removed - deprecated classes - - *All Hydrator classes* see #22. - - `Zend\Stdlib\CallbackHandler` see #35 -- [#37](https://github.com/zendframework/zend-stdlib/pull/37) - removed - deprecated classes and polyfills: - - `Zend\Stdlib\DateTime`; this had been deprecated since 2.5, and only - existed as a polyfill for the `createFromISO8601()` support, now standard - in all PHP versions we support. - - `Zend\Stdlib\Exception\InvalidCallbackException`, which was unused since #33. - - `Zend\Stdlib\Guard\GuardUtils`, which duplicated `Zend\Stdlib\Guard\AllGuardsTrait` - to allow usage with pre-PHP 5.4 versions. - - `src/compatibility/autoload.php`, which has been dprecated since 2.5. -- [#37](https://github.com/zendframework/zend-stdlib/pull/37) - removed - unneeded dependencies: - - zend-config (used only in testing ArrayUtils, and the test was redundant) - - zend-serializer (no longer used) -- [#51](https://github.com/zendframework/zend-stdlib/pull/51) removes the - documentation for hydrators, as those are part of the zend-hydrator - component. - -### Fixed - -- Nothing. - -## 2.7.4 - 2015-10-15 - -### Added - -- Nothing. - -### Deprecated - -- [#35](https://github.com/zendframework/zend-stdlib/pull/35) deprecates - `Zend\Stdlib\CallbackHandler`, as the one component that used it, - zend-eventmanager, will no longer depend on it starting in v3. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.7.3 - 2015-09-24 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#27](https://github.com/zendframework/zend-stdlib/pull/27) fixes a race - condition in the `FastPriorityQueue::remove()` logic that occurs when removing - items iteratively from the same priority of a queue. - -## 2.7.2 - 2015-09-23 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#26](https://github.com/zendframework/zend-stdlib/pull/26) fixes a subtle - inheritance issue with deprecation in the hydrators, and updates the - `HydratorInterface` to also extend the zend-hydrator `HydratorInterface` to - ensure LSP is preserved. - -## 2.7.1 - 2015-09-22 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#24](https://github.com/zendframework/zend-stdlib/pull/24) fixes an import in - `FastPriorityQueue` to alias `SplPriorityQueue` in order to disambiguate with - the local override present in the component. - -## 2.7.0 - 2015-09-22 - -### Added - -- [#19](https://github.com/zendframework/zend-stdlib/pull/19) adds a new - `FastPriorityQueue` implementation. It follows the same signature as - `SplPriorityQueue`, but uses a performance-optimized algorithm: - - - inserts are 2x faster than `SplPriorityQueue` and 3x faster than the - `Zend\Stdlib\PriorityQueue` implementation. - - extracts are 4x faster than `SplPriorityQueue` and 4-5x faster than the - `Zend\Stdlib\PriorityQueue` implementation. - - The intention is to use this as a drop-in replacement in the - `zend-eventmanager` component to provide performance benefits. - -### Deprecated - -- [#20](https://github.com/zendframework/zend-stdlib/pull/20) deprecates *all - hydrator* classes, in favor of the new [zend-hydrator](https://github.com/zendframework/zend-hydrator) - component. All classes were updated to extend their zend-hydrator equivalents, - and marked as `@deprecated`, indicating the equivalent class from the other - repository. - - Users *should* immediately start changing their code to use the zend-hydrator - equivalents; in most cases, this can be as easy as removing the `Stdlib` - namespace from import statements or hydrator configuration. Hydrators will be - removed entirely from zend-stdlib in v3.0, and all future updates to hydrators - will occur in the zend-hydrator library. - - Changes with backwards compatibility implications: - - - Users implementing `Zend\Stdlib\Hydrator\HydratorAwareInterface` will need to - update their `setHydrator()` implementation to typehint on - `Zend\Hydrator\HydratorInterface`. This can be done by changing the import - statement for that interface as follows: - - ```php - // Replace this: - use Zend\Stdlib\Hydrator\HydratorInterface; - // with this: - use Zend\Hydrator\HydratorInterface; - ``` - - If you are not using imports, change the typehint within the signature itself: - - ```php - // Replace this: - public function setHydrator(\Zend\Stdlib\Hydrator\HydratorInterface $hydrator) - // with this: - public function setHydrator(\Zend\Hydrator\HydratorInterface $hydrator) - ``` - - If you are using `Zend\Stdlib\Hydrator\HydratorAwareTrait`, no changes are - necessary, unless you override that method. - - - If you were catching hydrator-generated exceptions, these were previously in - the `Zend\Stdlib\Exception` namespace. You will need to update your code to - catch exceptions in the `Zend\Hydrator\Exception` namespace. - - - Users who *do* migrate to zend-hydrator may end up in a situation where - their code will not work with existing libraries that are still type-hinting - on the zend-stdlib interfaces. We will be attempting to address that ASAP, - but the deprecation within zend-stdlib is necessary as a first step. - - In the meantime, you can write hydrators targeting zend-stdlib still in - order to guarantee compatibility. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.6.0 - 2015-07-21 - -### Added - -- [#13](https://github.com/zendframework/zend-stdlib/pull/13) adds - `Zend\Stdlib\Hydrator\Iterator`, which provides mechanisms for hydrating - objects when iterating a traversable. This allows creating generic collection - resultsets; the original idea was pulled from - [PhlyMongo](https://github.com/phly/PhlyMongo), where it was used to hydrate - collections retrieved from MongoDB. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- Nothing. - -## 2.5.2 - 2015-07-21 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#9](https://github.com/zendframework/zend-stdlib/pull/9) fixes an issue with - count incrementation during insert in PriorityList, ensuring that incrementation only - occurs when the item inserted was not previously present in the list. - -## 2.4.4 - 2015-07-21 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- [#9](https://github.com/zendframework/zend-stdlib/pull/9) fixes an issue with - count incrementation during insert in PriorityList, ensuring that incrementation only - occurs when the item inserted was not previously present in the list. diff --git a/bundled-libs/zendframework/zend-stdlib/LICENSE.md b/bundled-libs/zendframework/zend-stdlib/LICENSE.md deleted file mode 100644 index d44ab5dc..00000000 --- a/bundled-libs/zendframework/zend-stdlib/LICENSE.md +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2005-2018, Zend Technologies USA, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -- Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -- Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bundled-libs/zendframework/zend-stdlib/README.md b/bundled-libs/zendframework/zend-stdlib/README.md deleted file mode 100644 index 8d9ff96c..00000000 --- a/bundled-libs/zendframework/zend-stdlib/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# zend-stdlib - -[![Build Status](https://secure.travis-ci.org/zendframework/zend-stdlib.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-stdlib) -[![Coverage Status](https://coveralls.io/repos/github/zendframework/zend-stdlib/badge.svg?branch=master)](https://coveralls.io/github/zendframework/zend-stdlib?branch=master) - -`Zend\Stdlib` is a set of components that implements general purpose utility -class for different scopes like: - -- array utilities functions; -- general messaging systems; -- string wrappers; -- etc. - ---- - -- File issues at https://github.com/zendframework/zend-stdlib/issues -- Documentation is at https://docs.zendframework.com/zend-stdlib/ - -## Benchmarks - -We provide scripts for benchmarking zend-stdlib using the -[PHPBench](https://github.com/phpbench/phpbench) framework; these can be -found in the `benchmark/` directory. - -To execute the benchmarks you can run the following command: - -```bash -$ vendor/bin/phpbench run --report=aggregate -``` diff --git a/bundled-libs/zendframework/zend-stdlib/benchmark/ExtractPriorityQueueBench.php b/bundled-libs/zendframework/zend-stdlib/benchmark/ExtractPriorityQueueBench.php deleted file mode 100644 index 5311a7bf..00000000 --- a/bundled-libs/zendframework/zend-stdlib/benchmark/ExtractPriorityQueueBench.php +++ /dev/null @@ -1,54 +0,0 @@ -splPriorityQueue = new SplPriorityQueue(); - $this->fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - - for ($i = 0; $i < 5000; $i += 1) { - $priority = rand(1, 100); - $this->splPriorityQueue->insert('foo', $priority); - $this->fastPriorityQueue->insert('foo', $priority); - $this->priorityQueue->insert('foo', $priority); - } - } - - public function benchExtractSplPriorityQueue() - { - $this->splPriorityQueue->extract(); - } - - public function benchExtractPriorityQueue() - { - $this->priorityQueue->extract(); - } - - public function benchExtractFastPriorityQueue() - { - $this->fastPriorityQueue->extract(); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/benchmark/InsertPriorityQueueBench.php b/bundled-libs/zendframework/zend-stdlib/benchmark/InsertPriorityQueueBench.php deleted file mode 100644 index db2bf5af..00000000 --- a/bundled-libs/zendframework/zend-stdlib/benchmark/InsertPriorityQueueBench.php +++ /dev/null @@ -1,47 +0,0 @@ -splPriorityQueue = new SplPriorityQueue(); - $this->fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - } - - public function benchInsertSplPriorityQueue() - { - $this->splPriorityQueue->insert('foo', rand(1, 100)); - } - - public function benchInsertPriorityQueue() - { - $this->priorityQueue->insert('foo', rand(1, 100)); - } - - public function benchInsertFastPriorityQueue() - { - $this->fastPriorityQueue->insert('foo', rand(1, 100)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/benchmark/RemovePriorityQueueBench.php b/bundled-libs/zendframework/zend-stdlib/benchmark/RemovePriorityQueueBench.php deleted file mode 100644 index b7cbbb17..00000000 --- a/bundled-libs/zendframework/zend-stdlib/benchmark/RemovePriorityQueueBench.php +++ /dev/null @@ -1,46 +0,0 @@ -fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - - for ($i = 0; $i < 1000; $i += 1) { - $priority = rand(1, 100); - $this->fastPriorityQueue->insert('foo', $priority); - $this->priorityQueue->insert('foo', $priority); - } - } - - public function benchRemovePriorityQueue() - { - $this->priorityQueue->remove('foo'); - } - - public function benchRemoveFastPriorityQueue() - { - $this->fastPriorityQueue->remove('foo'); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/composer.json b/bundled-libs/zendframework/zend-stdlib/composer.json deleted file mode 100644 index 8c990096..00000000 --- a/bundled-libs/zendframework/zend-stdlib/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "zendframework/zend-stdlib", - "description": "SPL extensions, array utilities, error handlers, and more", - "license": "BSD-3-Clause", - "keywords": [ - "zf", - "zendframework", - "stdlib" - ], - "support": { - "docs": "https://docs.zendframework.com/zend-stdlib/", - "issues": "https://github.com/zendframework/zend-stdlib/issues", - "source": "https://github.com/zendframework/zend-stdlib", - "rss": "https://github.com/zendframework/zend-stdlib/releases.atom", - "slack": "https://zendframework-slack.herokuapp.com", - "forum": "https://discourse.zendframework.com/c/questions/components" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpbench/phpbench": "^0.13", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0" - }, - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "ZendTest\\Stdlib\\": "test/", - "ZendBench\\Stdlib\\": "benchmark/" - } - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev", - "dev-develop": "3.3.x-dev" - } - }, - "scripts": { - "check": [ - "@cs-check", - "@test" - ], - "cs-check": "phpcs", - "cs-fix": "phpcbf", - "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/docs/CODE_OF_CONDUCT.md b/bundled-libs/zendframework/zend-stdlib/docs/CODE_OF_CONDUCT.md deleted file mode 100644 index 02fafcd1..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -This project adheres to [The Code Manifesto](http://codemanifesto.com) -as its guidelines for contributor interactions. - -## The Code Manifesto - -We want to work in an ecosystem that empowers developers to reach their -potential — one that encourages growth and effective collaboration. A space that -is safe for all. - -A space such as this benefits everyone that participates in it. It encourages -new developers to enter our field. It is through discussion and collaboration -that we grow, and through growth that we improve. - -In the effort to create such a place, we hold to these values: - -1. **Discrimination limits us.** This includes discrimination on the basis of - race, gender, sexual orientation, gender identity, age, nationality, technology - and any other arbitrary exclusion of a group of people. -2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort - levels. Remember that, and if brought to your attention, heed it. -3. **We are our biggest assets.** None of us were born masters of our trade. - Each of us has been helped along the way. Return that favor, when and where - you can. -4. **We are resources for the future.** As an extension of #3, share what you - know. Make yourself a resource to help those that come after you. -5. **Respect defines us.** Treat others as you wish to be treated. Make your - discussions, criticisms and debates from a position of respectfulness. Ask - yourself, is it true? Is it necessary? Is it constructive? Anything less is - unacceptable. -6. **Reactions require grace.** Angry responses are valid, but abusive language - and vindictive actions are toxic. When something happens that offends you, - handle it assertively, but be respectful. Escalate reasonably, and try to - allow the offender an opportunity to explain themselves, and possibly correct - the issue. -7. **Opinions are just that: opinions.** Each and every one of us, due to our - background and upbringing, have varying opinions. The fact of the matter, is - that is perfectly acceptable. Remember this: if you respect your own - opinions, you should respect the opinions of others. -8. **To err is human.** You might not intend it, but mistakes do happen and - contribute to build experience. Tolerate honest mistakes, and don't hesitate - to apologize if you make one yourself. diff --git a/bundled-libs/zendframework/zend-stdlib/docs/CONTRIBUTING.md b/bundled-libs/zendframework/zend-stdlib/docs/CONTRIBUTING.md deleted file mode 100644 index afefd081..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/CONTRIBUTING.md +++ /dev/null @@ -1,189 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to this project, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zend-coding-standard) - - [Forums](https://discourse.zendframework.com/c/contributors) - - [Slack](https://zendframework-slack.herokuapp.com) - - [Code of Conduct](CODE_OF_CONDUCT.md) - -If you are working on new features or refactoring -[create a proposal](https://github.com/zendframework/zend-stdlib/issues/new). - -## RUNNING TESTS - -To run tests: - -- Clone the repository: - - ```console - $ git clone git://github.com/zendframework/zend-stdlib.git - $ cd zend-stdlib - ``` - -- Install dependencies via composer: - - ```console - $ composer install - ``` - - If you don't have `composer` installed, please download it from https://getcomposer.org/download/ - -- Run the tests using the "test" command shipped in the `composer.json`: - - ```console - $ composer test - ``` - -You can turn on conditional tests with the `phpunit.xml` file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -First, ensure you've installed dependencies via composer, per the previous -section on running tests. - -To run CS checks only: - -```console -$ composer cs-check -``` - -To attempt to automatically fix common CS issues: - -```console -$ composer cs-fix -``` - -If the above fixes any CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](https://github.com/), if you haven't yet -2. Fork the repository (https://github.com/zendframework/zend-stdlib) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com/zendframework/zend-stdlib.git - $ cd zend-stdlib - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-stdlib.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-stdlib.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" (or whatever the upstream organization is) as the recipient. - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d - ``` - -- Remote branch removal - - ```console - $ git push {username} : - ``` diff --git a/bundled-libs/zendframework/zend-stdlib/docs/ISSUE_TEMPLATE.md b/bundled-libs/zendframework/zend-stdlib/docs/ISSUE_TEMPLATE.md deleted file mode 100644 index 55d12957..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,19 +0,0 @@ - - [ ] I was not able to find an [open](https://github.com/zendframework/zend-stdlib/issues?q=is%3Aopen) or [closed](https://github.com/zendframework/zend-stdlib/issues?q=is%3Aclosed) issue matching what I'm seeing. - - [ ] This is not a question. (Questions should be asked on [slack](https://zendframework.slack.com/) ([Signup for Slack here](https://zendframework-slack.herokuapp.com/)) or our [forums](https://discourse.zendframework.com/).) - -Provide a narrative description of what you are trying to accomplish. - -### Code to reproduce the issue - - - -```php -``` - -### Expected results - - - -### Actual results - - diff --git a/bundled-libs/zendframework/zend-stdlib/docs/PULL_REQUEST_TEMPLATE.md b/bundled-libs/zendframework/zend-stdlib/docs/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f00d90c0..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,25 +0,0 @@ -Provide a narrative description of what you are trying to accomplish: - -- [ ] Are you fixing a bug? - - [ ] Detail how the bug is invoked currently. - - [ ] Detail the original, incorrect behavior. - - [ ] Detail the new, expected behavior. - - [ ] Base your feature on the `master` branch, and submit against that branch. - - [ ] Add a regression test that demonstrates the bug, and proves the fix. - - [ ] Add a `CHANGELOG.md` entry for the fix. - -- [ ] Are you creating a new feature? - - [ ] Why is the new feature needed? What purpose does it serve? - - [ ] How will users use the new feature? - - [ ] Base your feature on the `develop` branch, and submit against that branch. - - [ ] Add only one feature per pull request; split multiple features over multiple pull requests - - [ ] Add tests for the new feature. - - [ ] Add documentation for the new feature. - - [ ] Add a `CHANGELOG.md` entry for the new feature. - -- [ ] Is this related to quality assurance? - - -- [ ] Is this related to documentation? - - diff --git a/bundled-libs/zendframework/zend-stdlib/docs/SUPPORT.md b/bundled-libs/zendframework/zend-stdlib/docs/SUPPORT.md deleted file mode 100644 index 82a7461b..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/SUPPORT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Getting Support - -Zend Framework offers three support channels: - -- For real-time questions, use our - [Slack](https://zendframework-slack.herokuapp.com) -- For detailed questions (e.g., those requiring examples) use our - [forums](https://discourse.zendframework.com/c/questions/components) -- To report issues, use this repository's - [issue tracker](https://github.com/zendframework/zend-stdlib/issues/new) - -**DO NOT** use the issue tracker to ask questions; use Slack or the forums for -that. Questions posed to the issue tracker will be closed. - -When reporting an issue, please include the following details: - -- A narrative description of what you are trying to accomplish. -- The minimum code necessary to reproduce the issue. -- The expected results of exercising that code. -- The actual results received. - -We may ask for additional details: what version of the library you are using, -and what PHP version was used to reproduce the issue. - -You may also submit a failing test case as a pull request. diff --git a/bundled-libs/zendframework/zend-stdlib/docs/book/console-helper.md b/bundled-libs/zendframework/zend-stdlib/docs/book/console-helper.md deleted file mode 100644 index 0a275667..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/book/console-helper.md +++ /dev/null @@ -1,126 +0,0 @@ -# Console Helper - -Writing one-off scripts or vendor binaries for a package is often problematic: - -- You need to parse arguments manually. -- You need to send output to the console in a meaningful fashion: - - Using `STDOUT` for meaningful, expected output - - Using `STDERR` for error messages - - Ensuring any line breaks are converted to `PHP_EOL` - - Optionally, using console colors to provide context, which means: - - Detecting whether or not the console supports colors in the first place - - Providing appropriate escape sequences to produce color - -`Zend\Stdlib\ConsoleHelper` helps to address the second major bullet point and -all beneath it in a minimal fashion. - -## Usage - -Typical usage is to instantiate a `ConsoleHelper`, and call one of its methods: - -```php -use Zend\Stdlib\ConsoleHelper; - -$helper = new ConsoleHelper(); -$helper->writeLine('This is output'); -``` - -You can optionally pass a PHP stream resource to the constructor, which will be -used to determine whether or not color support is available: - -```php -$helper = new ConsoleHelper($stream); -``` - -By default, it assumes `STDOUT`, and tests against that. - -## Available methods - -`ConsoleHelper` provides the following methods. - -### colorize - -- `colorize(string $string) : string` - -`colorize()` accepts a formatted string, and will then apply ANSI color -sequences to them, if color support is detected. - -The following sequences are currently supported: - -- `...` will apply a green color sequence around the provided text. -- `...` will apply a red color sequence around the provided text. - -You may mix multiple sequences within the same stream. - -### write - -- `write(string $string, bool $colorize = true, resource $stream = STDOUT) : void` - -Emits the provided `$string` to the provided `$stream` (which defaults to -`STDOUT` if not provided). Any EOL sequences are convered to `PHP_EOL`. If -`$colorize` is `true`, the string is first passed to `colorize()` as well. - -### writeline - -- `writeLine(string $string, bool $colorize = true, resource $stream = STDOUT) : void` - -Same as `write()`, except it also appends a `PHP_EOL` sequence to the `$string`. - -### writeErrorMessage - -- `writeErrorMessage(string $message)` - -Wraps `$message` in an `` sequence, and passes it to -`writeLine()`, using `STDERR` as the `$stream`. - -## Example - -Below is an example class that accepts an argument list, and determines how and -what to emit. - -```php -namespace Foo; - -use Zend\Stdlib\ConsoleHelper; - -class HelloWorld -{ - private $helper; - - public function __construct(ConsoleHelper $helper = null) - { - $this->helper = $helper ?: new ConsoleHelper(); - } - - public function __invoke(array $args) - { - if (! count($args)) { - $this->helper->writeErrorMessage('Missing arguments!'); - return; - } - - if (count($args) > 1) { - $this->helper->writeErrorMessage('Too many arguments!'); - return; - } - - $target = array_shift($args); - - $this->helper->writeLine(sprintf( - 'Hello %s', - $target - )); - } -} -``` - -## When to upgrade - -`ConsoleHelper` is deliberately simple, and assumes that your primary need for -console tooling is for output considerations. - -If you need to parse complex argument strings, we recommend using -[zend-console](https://docs.zendframework.com/zend-console/)/[zf-console](https://github.com/zfcampus/zf-console) -or [symfony/console](http://symfony.com/doc/current/components/console.html), -as these packages provide those capabilities, as well as far more colorization -and console feature detection facilities. diff --git a/bundled-libs/zendframework/zend-stdlib/docs/book/index.html b/bundled-libs/zendframework/zend-stdlib/docs/book/index.html deleted file mode 100644 index 68027545..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -

-
-

zend-stdlib

- -

SPL extensions, array utilities, error handlers, and more.

- -
$ composer require zendframework/zend-stdlib
-
-
- diff --git a/bundled-libs/zendframework/zend-stdlib/docs/book/migration.md b/bundled-libs/zendframework/zend-stdlib/docs/book/migration.md deleted file mode 100644 index a0c7ff39..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/book/migration.md +++ /dev/null @@ -1,60 +0,0 @@ -# Migration Guide - -## From v2 to v3 - -The changes made going from v2 to v3 were: - -- Removal of the Hydrator subcomponent. -- Removal of the `CallbackHandler` class. -- Removal of `Zend\Stdlib\Guard\GuardUtils`. - -### Hydrators - -The biggest single change from version 2 to version 3 is that the hydrator -subcomponent, which was deprecated in v2.7.0, is now removed. This means that if -you were using zend-stdlib principally for the hydrators, you need to convert -your code to use [zend-hydrator](https://github.com/zendframework/zend-hydrator). - -This will also mean a multi-step migration. zend-stdlib v3 pre-dates -zend-hydrator v2.1, which will be the first version that supports zend-stdlib v3 -and zend-servicemanager v3. If you are using Composer, the migration should be -seamless: - -- Remove your zend-stdlib dependency: - - ```bash - $ composer remove zendframework/zend-stdlib - ``` - -- Update to use zend-hydrator: - - ```bash - $ composer require zendframework/zend-hydrator - ``` - -When zend-hydrator updates to newer versions of zend-stdlib and -zend-servicemanager, you will either automatically get those versions, or you -can tell composer to use those specific versions: - -```bash -$ composer require "zendframework/zend-stdlib:^3.0" -``` - -### CallbackHandler - -`Zend\Stdlib\CallbackHandler` primarily existed for legacy purposes; it was -created before the `callable` typehint existed, so that we could typehint PHP -callables. It also provided some minimal features around lazy-loading callables -from instantiable classes, but these features were rarely used, and better -approaches already exist for handling such functinality in zend-servicemanager -and zend-expressive. - -As such, the class was marked deprecated in v2.7.0, and removed for v3.0.0. - -### GuardUtils - -Version 3 removes `Zend\Stdlib\Guard\GuardUtils`. This abstract class existed to -provide the functionality of the various traits also present in that -subcomponent, for consumers on versions of PHP earlier than 5.4. Since the -minimum required version is now PHP 5.5, the class is unnecessary. If you were -using it previously, compose the related traits instead. diff --git a/bundled-libs/zendframework/zend-stdlib/docs/bookdown.json b/bundled-libs/zendframework/zend-stdlib/docs/bookdown.json deleted file mode 100644 index ad93f485..00000000 --- a/bundled-libs/zendframework/zend-stdlib/docs/bookdown.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "title": "Zend\\Stdlib", - "target": "html/", - "content": [ - "book/zend.stdlib.hydrator.md", - "book/zend.stdlib.hydrator.filter.md", - "book/zend.stdlib.hydrator.strategy.md", - "book/zend.stdlib.hydrator.aggregate.md", - "book/zend.stdlib.hydrator.namingstrategy.compositenamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.identitynamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.mapnamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.underscorenamingstrategy.md" - ] -} \ No newline at end of file diff --git a/bundled-libs/zendframework/zend-stdlib/src/AbstractOptions.php b/bundled-libs/zendframework/zend-stdlib/src/AbstractOptions.php deleted file mode 100644 index 172f5d36..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/AbstractOptions.php +++ /dev/null @@ -1,178 +0,0 @@ -setFromArray($options); - } - } - - /** - * Set one or more configuration properties - * - * @param array|Traversable|AbstractOptions $options - * @throws Exception\InvalidArgumentException - * @return AbstractOptions Provides fluent interface - */ - public function setFromArray($options) - { - if ($options instanceof self) { - $options = $options->toArray(); - } - - if (! is_array($options) && ! $options instanceof Traversable) { - throw new Exception\InvalidArgumentException( - sprintf( - 'Parameter provided to %s must be an %s, %s or %s', - __METHOD__, - 'array', - 'Traversable', - 'Zend\Stdlib\AbstractOptions' - ) - ); - } - - foreach ($options as $key => $value) { - $this->__set($key, $value); - } - - return $this; - } - - /** - * Cast to array - * - * @return array - */ - public function toArray() - { - $array = []; - $transform = function ($letters) { - $letter = array_shift($letters); - return '_' . strtolower($letter); - }; - foreach ($this as $key => $value) { - if ($key === '__strictMode__') { - continue; - } - $normalizedKey = preg_replace_callback('/([A-Z])/', $transform, $key); - $array[$normalizedKey] = $value; - } - return $array; - } - - /** - * Set a configuration property - * - * @see ParameterObject::__set() - * @param string $key - * @param mixed $value - * @throws Exception\BadMethodCallException - * @return void - */ - public function __set($key, $value) - { - $setter = 'set' . str_replace('_', '', $key); - - if (is_callable([$this, $setter])) { - $this->{$setter}($value); - - return; - } - - if ($this->__strictMode__) { - throw new Exception\BadMethodCallException(sprintf( - 'The option "%s" does not have a callable "%s" ("%s") setter method which must be defined', - $key, - 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))), - $setter - )); - } - } - - /** - * Get a configuration property - * - * @see ParameterObject::__get() - * @param string $key - * @throws Exception\BadMethodCallException - * @return mixed - */ - public function __get($key) - { - $getter = 'get' . str_replace('_', '', $key); - - if (is_callable([$this, $getter])) { - return $this->{$getter}(); - } - - throw new Exception\BadMethodCallException(sprintf( - 'The option "%s" does not have a callable "%s" getter method which must be defined', - $key, - 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))) - )); - } - - /** - * Test if a configuration property is null - * @see ParameterObject::__isset() - * @param string $key - * @return bool - */ - public function __isset($key) - { - $getter = 'get' . str_replace('_', '', $key); - - return method_exists($this, $getter) && null !== $this->__get($key); - } - - /** - * Set a configuration property to NULL - * - * @see ParameterObject::__unset() - * @param string $key - * @throws Exception\InvalidArgumentException - * @return void - */ - public function __unset($key) - { - try { - $this->__set($key, null); - } catch (Exception\BadMethodCallException $e) { - throw new Exception\InvalidArgumentException( - 'The class property $' . $key . ' cannot be unset as' - . ' NULL is an invalid value for it', - 0, - $e - ); - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ArrayObject.php b/bundled-libs/zendframework/zend-stdlib/src/ArrayObject.php deleted file mode 100644 index 8c77c620..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ArrayObject.php +++ /dev/null @@ -1,434 +0,0 @@ -setFlags($flags); - $this->storage = $input; - $this->setIteratorClass($iteratorClass); - $this->protectedProperties = array_keys(get_object_vars($this)); - } - - /** - * Returns whether the requested key exists - * - * @param mixed $key - * @return bool - */ - public function __isset($key) - { - if ($this->flag == self::ARRAY_AS_PROPS) { - return $this->offsetExists($key); - } - if (in_array($key, $this->protectedProperties)) { - throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); - } - - return isset($this->$key); - } - - /** - * Sets the value at the specified key to value - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - if ($this->flag == self::ARRAY_AS_PROPS) { - return $this->offsetSet($key, $value); - } - if (in_array($key, $this->protectedProperties)) { - throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); - } - $this->$key = $value; - } - - /** - * Unsets the value at the specified key - * - * @param mixed $key - * @return void - */ - public function __unset($key) - { - if ($this->flag == self::ARRAY_AS_PROPS) { - return $this->offsetUnset($key); - } - if (in_array($key, $this->protectedProperties)) { - throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); - } - unset($this->$key); - } - - /** - * Returns the value at the specified key by reference - * - * @param mixed $key - * @return mixed - */ - public function &__get($key) - { - $ret = null; - if ($this->flag == self::ARRAY_AS_PROPS) { - $ret =& $this->offsetGet($key); - - return $ret; - } - if (in_array($key, $this->protectedProperties)) { - throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); - } - - return $this->$key; - } - - /** - * Appends the value - * - * @param mixed $value - * @return void - */ - public function append($value) - { - $this->storage[] = $value; - } - - /** - * Sort the entries by value - * - * @return void - */ - public function asort() - { - asort($this->storage); - } - - /** - * Get the number of public properties in the ArrayObject - * - * @return int - */ - public function count() - { - return count($this->storage); - } - - /** - * Exchange the array for another one. - * - * @param array|ArrayObject $data - * @return array - */ - public function exchangeArray($data) - { - if (! is_array($data) && ! is_object($data)) { - throw new Exception\InvalidArgumentException( - 'Passed variable is not an array or object, using empty array instead' - ); - } - - if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) { - $data = $data->getArrayCopy(); - } - if (! is_array($data)) { - $data = (array) $data; - } - - $storage = $this->storage; - - $this->storage = $data; - - return $storage; - } - - /** - * Creates a copy of the ArrayObject. - * - * @return array - */ - public function getArrayCopy() - { - return $this->storage; - } - - /** - * Gets the behavior flags. - * - * @return int - */ - public function getFlags() - { - return $this->flag; - } - - /** - * Create a new iterator from an ArrayObject instance - * - * @return \Iterator - */ - public function getIterator() - { - $class = $this->iteratorClass; - - return new $class($this->storage); - } - - /** - * Gets the iterator classname for the ArrayObject. - * - * @return string - */ - public function getIteratorClass() - { - return $this->iteratorClass; - } - - /** - * Sort the entries by key - * - * @return void - */ - public function ksort() - { - ksort($this->storage); - } - - /** - * Sort an array using a case insensitive "natural order" algorithm - * - * @return void - */ - public function natcasesort() - { - natcasesort($this->storage); - } - - /** - * Sort entries using a "natural order" algorithm - * - * @return void - */ - public function natsort() - { - natsort($this->storage); - } - - /** - * Returns whether the requested key exists - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key) - { - return isset($this->storage[$key]); - } - - /** - * Returns the value at the specified key - * - * @param mixed $key - * @return mixed - */ - public function &offsetGet($key) - { - $ret = null; - if (! $this->offsetExists($key)) { - return $ret; - } - $ret =& $this->storage[$key]; - - return $ret; - } - - /** - * Sets the value at the specified key to value - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->storage[$key] = $value; - } - - /** - * Unsets the value at the specified key - * - * @param mixed $key - * @return void - */ - public function offsetUnset($key) - { - if ($this->offsetExists($key)) { - unset($this->storage[$key]); - } - } - - /** - * Serialize an ArrayObject - * - * @return string - */ - public function serialize() - { - return serialize(get_object_vars($this)); - } - - /** - * Sets the behavior flags - * - * @param int $flags - * @return void - */ - public function setFlags($flags) - { - $this->flag = $flags; - } - - /** - * Sets the iterator classname for the ArrayObject - * - * @param string $class - * @return void - */ - public function setIteratorClass($class) - { - if (class_exists($class)) { - $this->iteratorClass = $class; - - return ; - } - - if (strpos($class, '\\') === 0) { - $class = '\\' . $class; - if (class_exists($class)) { - $this->iteratorClass = $class; - - return ; - } - } - - throw new Exception\InvalidArgumentException('The iterator class does not exist'); - } - - /** - * Sort the entries with a user-defined comparison function and maintain key association - * - * @param callable $function - * @return void - */ - public function uasort($function) - { - if (is_callable($function)) { - uasort($this->storage, $function); - } - } - - /** - * Sort the entries by keys using a user-defined comparison function - * - * @param callable $function - * @return void - */ - public function uksort($function) - { - if (is_callable($function)) { - uksort($this->storage, $function); - } - } - - /** - * Unserialize an ArrayObject - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - $ar = unserialize($data); - $this->protectedProperties = array_keys(get_object_vars($this)); - - $this->setFlags($ar['flag']); - $this->exchangeArray($ar['storage']); - $this->setIteratorClass($ar['iteratorClass']); - - foreach ($ar as $k => $v) { - switch ($k) { - case 'flag': - $this->setFlags($v); - break; - case 'storage': - $this->exchangeArray($v); - break; - case 'iteratorClass': - $this->setIteratorClass($v); - break; - case 'protectedProperties': - break; - default: - $this->__set($k, $v); - } - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ArraySerializableInterface.php b/bundled-libs/zendframework/zend-stdlib/src/ArraySerializableInterface.php deleted file mode 100644 index dcf84719..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ArraySerializableInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getArrayCopy(); - return new ArrayIterator(array_reverse($array)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils.php b/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils.php deleted file mode 100644 index 4edcacf1..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils.php +++ /dev/null @@ -1,314 +0,0 @@ - 0; - } - - /** - * Test whether an array contains one or more integer keys - * - * @param mixed $value - * @param bool $allowEmpty Should an empty array() return true - * @return bool - */ - public static function hasIntegerKeys($value, $allowEmpty = false) - { - if (! is_array($value)) { - return false; - } - - if (! $value) { - return $allowEmpty; - } - - return count(array_filter(array_keys($value), 'is_int')) > 0; - } - - /** - * Test whether an array contains one or more numeric keys. - * - * A numeric key can be one of the following: - * - an integer 1, - * - a string with a number '20' - * - a string with negative number: '-1000' - * - a float: 2.2120, -78.150999 - * - a string with float: '4000.99999', '-10.10' - * - * @param mixed $value - * @param bool $allowEmpty Should an empty array() return true - * @return bool - */ - public static function hasNumericKeys($value, $allowEmpty = false) - { - if (! is_array($value)) { - return false; - } - - if (! $value) { - return $allowEmpty; - } - - return count(array_filter(array_keys($value), 'is_numeric')) > 0; - } - - /** - * Test whether an array is a list - * - * A list is a collection of values assigned to continuous integer keys - * starting at 0 and ending at count() - 1. - * - * For example: - * - * $list = array('a', 'b', 'c', 'd'); - * $list = array( - * 0 => 'foo', - * 1 => 'bar', - * 2 => array('foo' => 'baz'), - * ); - * - * - * @param mixed $value - * @param bool $allowEmpty Is an empty list a valid list? - * @return bool - */ - public static function isList($value, $allowEmpty = false) - { - if (! is_array($value)) { - return false; - } - - if (! $value) { - return $allowEmpty; - } - - return (array_values($value) === $value); - } - - /** - * Test whether an array is a hash table. - * - * An array is a hash table if: - * - * 1. Contains one or more non-integer keys, or - * 2. Integer keys are non-continuous or misaligned (not starting with 0) - * - * For example: - * - * $hash = array( - * 'foo' => 15, - * 'bar' => false, - * ); - * $hash = array( - * 1995 => 'Birth of PHP', - * 2009 => 'PHP 5.3.0', - * 2012 => 'PHP 5.4.0', - * ); - * $hash = array( - * 'formElement, - * 'options' => array( 'debug' => true ), - * ); - * - * - * @param mixed $value - * @param bool $allowEmpty Is an empty array() a valid hash table? - * @return bool - */ - public static function isHashTable($value, $allowEmpty = false) - { - if (! is_array($value)) { - return false; - } - - if (! $value) { - return $allowEmpty; - } - - return (array_values($value) !== $value); - } - - /** - * Checks if a value exists in an array. - * - * Due to "foo" == 0 === TRUE with in_array when strict = false, an option - * has been added to prevent this. When $strict = 0/false, the most secure - * non-strict check is implemented. if $strict = -1, the default in_array - * non-strict behaviour is used. - * - * @param mixed $needle - * @param array $haystack - * @param int|bool $strict - * @return bool - */ - public static function inArray($needle, array $haystack, $strict = false) - { - if (! $strict) { - if (is_int($needle) || is_float($needle)) { - $needle = (string) $needle; - } - if (is_string($needle)) { - foreach ($haystack as &$h) { - if (is_int($h) || is_float($h)) { - $h = (string) $h; - } - } - } - } - return in_array($needle, $haystack, $strict); - } - - /** - * Convert an iterator to an array. - * - * Converts an iterator to an array. The $recursive flag, on by default, - * hints whether or not you want to do so recursively. - * - * @param array|Traversable $iterator The array or Traversable object to convert - * @param bool $recursive Recursively check all nested structures - * @throws Exception\InvalidArgumentException if $iterator is not an array or a Traversable object - * @return array - */ - public static function iteratorToArray($iterator, $recursive = true) - { - if (! is_array($iterator) && ! $iterator instanceof Traversable) { - throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); - } - - if (! $recursive) { - if (is_array($iterator)) { - return $iterator; - } - - return iterator_to_array($iterator); - } - - if (method_exists($iterator, 'toArray')) { - return $iterator->toArray(); - } - - $array = []; - foreach ($iterator as $key => $value) { - if (is_scalar($value)) { - $array[$key] = $value; - continue; - } - - if ($value instanceof Traversable) { - $array[$key] = static::iteratorToArray($value, $recursive); - continue; - } - - if (is_array($value)) { - $array[$key] = static::iteratorToArray($value, $recursive); - continue; - } - - $array[$key] = $value; - } - - return $array; - } - - /** - * Merge two arrays together. - * - * If an integer key exists in both arrays and preserveNumericKeys is false, the value - * from the second array will be appended to the first array. If both values are arrays, they - * are merged together, else the value of the second array overwrites the one of the first array. - * - * @param array $a - * @param array $b - * @param bool $preserveNumericKeys - * @return array - */ - public static function merge(array $a, array $b, $preserveNumericKeys = false) - { - foreach ($b as $key => $value) { - if ($value instanceof MergeReplaceKeyInterface) { - $a[$key] = $value->getData(); - } elseif (isset($a[$key]) || array_key_exists($key, $a)) { - if ($value instanceof MergeRemoveKey) { - unset($a[$key]); - } elseif (! $preserveNumericKeys && is_int($key)) { - $a[] = $value; - } elseif (is_array($value) && is_array($a[$key])) { - $a[$key] = static::merge($a[$key], $value, $preserveNumericKeys); - } else { - $a[$key] = $value; - } - } else { - if (! $value instanceof MergeRemoveKey) { - $a[$key] = $value; - } - } - } - - return $a; - } - - /** - * @deprecated Since 3.2.0; use the native array_filter methods - * - * @param array $data - * @param callable $callback - * @param null|int $flag - * @return array - * @throws Exception\InvalidArgumentException - */ - public static function filter(array $data, $callback, $flag = null) - { - if (! is_callable($callback)) { - throw new Exception\InvalidArgumentException(sprintf( - 'Second parameter of %s must be callable', - __METHOD__ - )); - } - - return array_filter($data, $callback, $flag); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php b/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php deleted file mode 100644 index 7c4d097d..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php +++ /dev/null @@ -1,14 +0,0 @@ -data = $data; - } - - /** - * {@inheritDoc} - */ - public function getData() - { - return $this->data; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php b/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php deleted file mode 100644 index 725cf11b..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -message`, - * `message`) - * - Write output to a specified stream, optionally with colorization. - * - Write a line of output to a specified stream, optionally with - * colorization, using the system EOL sequence.. - * - Write an error message to STDERR. - * - * Colorization will only occur when expected sequences are discovered, and - * then, only if the console terminal allows it. - * - * Essentially, provides the bare minimum to allow you to provide messages to - * the current console. - */ -class ConsoleHelper -{ - const COLOR_GREEN = "\033[32m"; - const COLOR_RED = "\033[31m"; - const COLOR_RESET = "\033[0m"; - - const HIGHLIGHT_INFO = 'info'; - const HIGHLIGHT_ERROR = 'error'; - - private $highlightMap = [ - self::HIGHLIGHT_INFO => self::COLOR_GREEN, - self::HIGHLIGHT_ERROR => self::COLOR_RED, - ]; - - /** - * @var string Exists only for testing. - */ - private $eol = PHP_EOL; - - /** - * @var resource Exists only for testing. - */ - private $stderr = STDERR; - - /** - * @var bool - */ - private $supportsColor; - - /** - * @param resource $resource - */ - public function __construct($resource = STDOUT) - { - $this->supportsColor = $this->detectColorCapabilities($resource); - } - - /** - * Colorize a string for use with the terminal. - * - * Takes strings formatted as `string` and formats them per the - * $highlightMap; if color support is disabled, simply removes the formatting - * tags. - * - * @param string $string - * @return string - */ - public function colorize($string) - { - $reset = $this->supportsColor ? self::COLOR_RESET : ''; - foreach ($this->highlightMap as $key => $color) { - $pattern = sprintf('#<%s>(.*?)#s', $key, $key); - $color = $this->supportsColor ? $color : ''; - $string = preg_replace($pattern, $color . '$1' . $reset, $string); - } - return $string; - } - - /** - * @param string $string - * @param bool $colorize Whether or not to colorize the string - * @param resource $resource Defaults to STDOUT - * @return void - */ - public function write($string, $colorize = true, $resource = STDOUT) - { - if ($colorize) { - $string = $this->colorize($string); - } - - $string = $this->formatNewlines($string); - - fwrite($resource, $string); - } - - /** - * @param string $string - * @param bool $colorize Whether or not to colorize the line - * @param resource $resource Defaults to STDOUT - * @return void - */ - public function writeLine($string, $colorize = true, $resource = STDOUT) - { - $this->write($string . $this->eol, $colorize, $resource); - } - - /** - * Emit an error message. - * - * Wraps the message in ``, and passes it to `writeLine()`, - * using STDERR as the resource; emits an additional empty line when done, - * also to STDERR. - * - * @param string $message - * @return void - */ - public function writeErrorMessage($message) - { - $this->writeLine(sprintf('%s', $message), true, $this->stderr); - $this->writeLine('', false, $this->stderr); - } - - /** - * @param resource $resource - * @return bool - */ - private function detectColorCapabilities($resource = STDOUT) - { - if ('\\' === DIRECTORY_SEPARATOR) { - // Windows - return false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); - } - - return function_exists('posix_isatty') && posix_isatty($resource); - } - - /** - * Ensure newlines are appropriate for the current terminal. - * - * @param string - * @return string - */ - private function formatNewlines($string) - { - $string = str_replace($this->eol, "\0PHP_EOL\0", $string); - $string = preg_replace("/(\r\n|\n|\r)/", $this->eol, $string); - return str_replace("\0PHP_EOL\0", $this->eol, $string); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/DispatchableInterface.php b/bundled-libs/zendframework/zend-stdlib/src/DispatchableInterface.php deleted file mode 100644 index 4f74d1e8..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/DispatchableInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -values[$priority][] = $value; - if (! isset($this->priorities[$priority])) { - $this->priorities[$priority] = $priority; - $this->maxPriority = $this->maxPriority === null ? $priority : max($priority, $this->maxPriority); - } - ++$this->count; - } - - /** - * Extract an element in the queue according to the priority and the - * order of insertion - * - * @return mixed - */ - public function extract() - { - if (! $this->valid()) { - return false; - } - $value = $this->current(); - $this->nextAndRemove(); - return $value; - } - - /** - * Remove an item from the queue - * - * This is different than {@link extract()}; its purpose is to dequeue an - * item. - * - * Note: this removes the first item matching the provided item found. If - * the same item has been added multiple times, it will not remove other - * instances. - * - * @param mixed $datum - * @return bool False if the item was not found, true otherwise. - */ - public function remove($datum) - { - $currentIndex = $this->index; - $currentSubIndex = $this->subIndex; - $currentPriority = $this->maxPriority; - - $this->rewind(); - while ($this->valid()) { - if (current($this->values[$this->maxPriority]) === $datum) { - $index = key($this->values[$this->maxPriority]); - unset($this->values[$this->maxPriority][$index]); - - // The `next()` method advances the internal array pointer, so we need to use the `reset()` function, - // otherwise we would lose all elements before the place the pointer points. - reset($this->values[$this->maxPriority]); - - $this->index = $currentIndex; - $this->subIndex = $currentSubIndex; - - // If the array is empty we need to destroy the unnecessary priority, - // otherwise we would end up with an incorrect value of `$this->count` - // {@see \Zend\Stdlib\FastPriorityQueue::nextAndRemove()}. - if (empty($this->values[$this->maxPriority])) { - unset($this->values[$this->maxPriority]); - unset($this->priorities[$this->maxPriority]); - if ($this->maxPriority === $currentPriority) { - $this->subIndex = 0; - } - } - - $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); - --$this->count; - return true; - } - $this->next(); - } - return false; - } - - /** - * Get the total number of elements in the queue - * - * @return integer - */ - public function count() - { - return $this->count; - } - - /** - * Get the current element in the queue - * - * @return mixed - */ - public function current() - { - switch ($this->extractFlag) { - case self::EXTR_DATA: - return current($this->values[$this->maxPriority]); - case self::EXTR_PRIORITY: - return $this->maxPriority; - case self::EXTR_BOTH: - return [ - 'data' => current($this->values[$this->maxPriority]), - 'priority' => $this->maxPriority - ]; - } - } - - /** - * Get the index of the current element in the queue - * - * @return integer - */ - public function key() - { - return $this->index; - } - - /** - * Set the iterator pointer to the next element in the queue - * removing the previous element - */ - protected function nextAndRemove() - { - $key = key($this->values[$this->maxPriority]); - - if (false === next($this->values[$this->maxPriority])) { - unset($this->priorities[$this->maxPriority]); - unset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); - $this->subIndex = -1; - } else { - unset($this->values[$this->maxPriority][$key]); - } - ++$this->index; - ++$this->subIndex; - --$this->count; - } - - /** - * Set the iterator pointer to the next element in the queue - * without removing the previous element - */ - public function next() - { - if (false === next($this->values[$this->maxPriority])) { - unset($this->subPriorities[$this->maxPriority]); - reset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->subPriorities) ? null : max($this->subPriorities); - $this->subIndex = -1; - } - ++$this->index; - ++$this->subIndex; - } - - /** - * Check if the current iterator is valid - * - * @return boolean - */ - public function valid() - { - return isset($this->values[$this->maxPriority]); - } - - /** - * Rewind the current iterator - */ - public function rewind() - { - $this->subPriorities = $this->priorities; - $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); - $this->index = 0; - $this->subIndex = 0; - } - - /** - * Serialize to an array - * - * Array will be priority => data pairs - * - * @return array - */ - public function toArray() - { - $array = []; - foreach (clone $this as $item) { - $array[] = $item; - } - return $array; - } - - /** - * Serialize - * - * @return string - */ - public function serialize() - { - $clone = clone $this; - $clone->setExtractFlags(self::EXTR_BOTH); - - $data = []; - foreach ($clone as $item) { - $data[] = $item; - } - - return serialize($data); - } - - /** - * Deserialize - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->insert($item['data'], $item['priority']); - } - } - - /** - * Set the extract flag - * - * @param integer $flag - */ - public function setExtractFlags($flag) - { - switch ($flag) { - case self::EXTR_DATA: - case self::EXTR_PRIORITY: - case self::EXTR_BOTH: - $this->extractFlag = $flag; - break; - default: - throw new Exception\InvalidArgumentException("The extract flag specified is not valid"); - } - } - - /** - * Check if the queue is empty - * - * @return boolean - */ - public function isEmpty() - { - return empty($this->values); - } - - /** - * Does the queue contain the given datum? - * - * @param mixed $datum - * @return bool - */ - public function contains($datum) - { - foreach ($this->values as $values) { - if (in_array($datum, $values)) { - return true; - } - } - return false; - } - - /** - * Does the queue have an item with the given priority? - * - * @param int $priority - * @return bool - */ - public function hasPriority($priority) - { - return isset($this->values[$priority]); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/Glob.php b/bundled-libs/zendframework/zend-stdlib/src/Glob.php deleted file mode 100644 index ded3fc53..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/Glob.php +++ /dev/null @@ -1,202 +0,0 @@ - GLOB_MARK, - self::GLOB_NOSORT => GLOB_NOSORT, - self::GLOB_NOCHECK => GLOB_NOCHECK, - self::GLOB_NOESCAPE => GLOB_NOESCAPE, - self::GLOB_BRACE => defined('GLOB_BRACE') ? GLOB_BRACE : 0, - self::GLOB_ONLYDIR => GLOB_ONLYDIR, - self::GLOB_ERR => GLOB_ERR, - ]; - - $globFlags = 0; - - foreach ($flagMap as $internalFlag => $globFlag) { - if ($flags & $internalFlag) { - $globFlags |= $globFlag; - } - } - } else { - $globFlags = 0; - } - - ErrorHandler::start(); - $res = glob($pattern, $globFlags); - $err = ErrorHandler::stop(); - if ($res === false) { - throw new Exception\RuntimeException("glob('{$pattern}', {$globFlags}) failed", 0, $err); - } - return $res; - } - - /** - * Expand braces manually, then use the system glob. - * - * @param string $pattern - * @param int $flags - * @return array - * @throws Exception\RuntimeException - */ - protected static function fallbackGlob($pattern, $flags) - { - if (! $flags & self::GLOB_BRACE) { - return static::systemGlob($pattern, $flags); - } - - $flags &= ~self::GLOB_BRACE; - $length = strlen($pattern); - $paths = []; - - if ($flags & self::GLOB_NOESCAPE) { - $begin = strpos($pattern, '{'); - } else { - $begin = 0; - - while (true) { - if ($begin === $length) { - $begin = false; - break; - } elseif ($pattern[$begin] === '\\' && ($begin + 1) < $length) { - $begin++; - } elseif ($pattern[$begin] === '{') { - break; - } - - $begin++; - } - } - - if ($begin === false) { - return static::systemGlob($pattern, $flags); - } - - $next = static::nextBraceSub($pattern, $begin + 1, $flags); - - if ($next === null) { - return static::systemGlob($pattern, $flags); - } - - $rest = $next; - - while ($pattern[$rest] !== '}') { - $rest = static::nextBraceSub($pattern, $rest + 1, $flags); - - if ($rest === null) { - return static::systemGlob($pattern, $flags); - } - } - - $p = $begin + 1; - - while (true) { - $subPattern = substr($pattern, 0, $begin) - . substr($pattern, $p, $next - $p) - . substr($pattern, $rest + 1); - - $result = static::fallbackGlob($subPattern, $flags | self::GLOB_BRACE); - - if ($result) { - $paths = array_merge($paths, $result); - } - - if ($pattern[$next] === '}') { - break; - } - - $p = $next + 1; - $next = static::nextBraceSub($pattern, $p, $flags); - } - - return array_unique($paths); - } - - /** - * Find the end of the sub-pattern in a brace expression. - * - * @param string $pattern - * @param int $begin - * @param int $flags - * @return int|null - */ - protected static function nextBraceSub($pattern, $begin, $flags) - { - $length = strlen($pattern); - $depth = 0; - $current = $begin; - - while ($current < $length) { - if (! $flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { - if (++$current === $length) { - break; - } - - $current++; - } else { - if (($pattern[$current] === '}' && $depth-- === 0) || ($pattern[$current] === ',' && $depth === 0)) { - break; - } elseif ($pattern[$current++] === '{') { - $depth++; - } - } - } - - return ($current < $length ? $current : null); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php b/bundled-libs/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php deleted file mode 100644 index 95bc5162..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php +++ /dev/null @@ -1,20 +0,0 @@ -metadata[$spec] = $value; - return $this; - } - if (! is_array($spec) && ! $spec instanceof Traversable) { - throw new Exception\InvalidArgumentException(sprintf( - 'Expected a string, array, or Traversable argument in first position; received "%s"', - (is_object($spec) ? get_class($spec) : gettype($spec)) - )); - } - foreach ($spec as $key => $value) { - $this->metadata[$key] = $value; - } - return $this; - } - - /** - * Retrieve all metadata or a single metadatum as specified by key - * - * @param null|string|int $key - * @param null|mixed $default - * @throws Exception\InvalidArgumentException - * @return mixed - */ - public function getMetadata($key = null, $default = null) - { - if (null === $key) { - return $this->metadata; - } - - if (! is_scalar($key)) { - throw new Exception\InvalidArgumentException('Non-scalar argument provided for key'); - } - - if (array_key_exists($key, $this->metadata)) { - return $this->metadata[$key]; - } - - return $default; - } - - /** - * Set message content - * - * @param mixed $value - * @return Message - */ - public function setContent($value) - { - $this->content = $value; - return $this; - } - - /** - * Get message content - * - * @return mixed - */ - public function getContent() - { - return $this->content; - } - - /** - * @return string - */ - public function toString() - { - $request = ''; - foreach ($this->getMetadata() as $key => $value) { - $request .= sprintf( - "%s: %s\r\n", - (string) $key, - (string) $value - ); - } - $request .= "\r\n" . $this->getContent(); - return $request; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/MessageInterface.php b/bundled-libs/zendframework/zend-stdlib/src/MessageInterface.php deleted file mode 100644 index 28d8857f..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/MessageInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -exchangeArray($values); - } - - /** - * Populate from query string - * - * @param string $string - * @return void - */ - public function fromString($string) - { - $array = []; - parse_str($string, $array); - $this->fromArray($array); - } - - /** - * Serialize to native PHP array - * - * @return array - */ - public function toArray() - { - return $this->getArrayCopy(); - } - - /** - * Serialize to query string - * - * @return string - */ - public function toString() - { - return http_build_query($this->toArray()); - } - - /** - * Retrieve by key - * - * Returns null if the key does not exist. - * - * @param string $name - * @return mixed - */ - public function offsetGet($name) - { - if ($this->offsetExists($name)) { - return parent::offsetGet($name); - } - return; - } - - /** - * @param string $name - * @param mixed $default optional default value - * @return mixed - */ - public function get($name, $default = null) - { - if ($this->offsetExists($name)) { - return parent::offsetGet($name); - } - return $default; - } - - /** - * @param string $name - * @param mixed $value - * @return Parameters - */ - public function set($name, $value) - { - $this[$name] = $value; - return $this; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/ParametersInterface.php b/bundled-libs/zendframework/zend-stdlib/src/ParametersInterface.php deleted file mode 100644 index feeda580..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/ParametersInterface.php +++ /dev/null @@ -1,86 +0,0 @@ -items[$name])) { - $this->count++; - } - - $this->sorted = false; - - $this->items[$name] = [ - 'data' => $value, - 'priority' => (int) $priority, - 'serial' => $this->serial++, - ]; - } - - /** - * @param string $name - * @param int $priority - * - * @return $this - * - * @throws \Exception - */ - public function setPriority($name, $priority) - { - if (! isset($this->items[$name])) { - throw new \Exception("item $name not found"); - } - - $this->items[$name]['priority'] = (int) $priority; - $this->sorted = false; - - return $this; - } - - /** - * Remove a item. - * - * @param string $name - * @return void - */ - public function remove($name) - { - if (isset($this->items[$name])) { - $this->count--; - } - - unset($this->items[$name]); - } - - /** - * Remove all items. - * - * @return void - */ - public function clear() - { - $this->items = []; - $this->serial = 0; - $this->count = 0; - $this->sorted = false; - } - - /** - * Get a item. - * - * @param string $name - * @return mixed - */ - public function get($name) - { - if (! isset($this->items[$name])) { - return; - } - - return $this->items[$name]['data']; - } - - /** - * Sort all items. - * - * @return void - */ - protected function sort() - { - if (! $this->sorted) { - uasort($this->items, [$this, 'compare']); - $this->sorted = true; - } - } - - /** - * Compare the priority of two items. - * - * @param array $item1, - * @param array $item2 - * @return int - */ - protected function compare(array $item1, array $item2) - { - return ($item1['priority'] === $item2['priority']) - ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO - : ($item1['priority'] > $item2['priority'] ? -1 : 1); - } - - /** - * Get/Set serial order mode - * - * @param bool|null $flag - * - * @return bool - */ - public function isLIFO($flag = null) - { - if ($flag !== null) { - $isLifo = $flag === true ? 1 : -1; - - if ($isLifo !== $this->isLIFO) { - $this->isLIFO = $isLifo; - $this->sorted = false; - } - } - - return 1 === $this->isLIFO; - } - - /** - * {@inheritDoc} - */ - public function rewind() - { - $this->sort(); - reset($this->items); - } - - /** - * {@inheritDoc} - */ - public function current() - { - $this->sorted || $this->sort(); - $node = current($this->items); - - return $node ? $node['data'] : false; - } - - /** - * {@inheritDoc} - */ - public function key() - { - $this->sorted || $this->sort(); - return key($this->items); - } - - /** - * {@inheritDoc} - */ - public function next() - { - $node = next($this->items); - - return $node ? $node['data'] : false; - } - - /** - * {@inheritDoc} - */ - public function valid() - { - return current($this->items) !== false; - } - - /** - * @return self - */ - public function getIterator() - { - return clone $this; - } - - /** - * {@inheritDoc} - */ - public function count() - { - return $this->count; - } - - /** - * Return list as array - * - * @param int $flag - * - * @return array - */ - public function toArray($flag = self::EXTR_DATA) - { - $this->sort(); - - if ($flag == self::EXTR_BOTH) { - return $this->items; - } - - return array_map( - function ($item) use ($flag) { - return ($flag == PriorityList::EXTR_PRIORITY) ? $item['priority'] : $item['data']; - }, - $this->items - ); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/PriorityQueue.php b/bundled-libs/zendframework/zend-stdlib/src/PriorityQueue.php deleted file mode 100644 index 2a162873..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/PriorityQueue.php +++ /dev/null @@ -1,301 +0,0 @@ -items[] = [ - 'data' => $data, - 'priority' => $priority, - ]; - $this->getQueue()->insert($data, $priority); - return $this; - } - - /** - * Remove an item from the queue - * - * This is different than {@link extract()}; its purpose is to dequeue an - * item. - * - * This operation is potentially expensive, as it requires - * re-initialization and re-population of the inner queue. - * - * Note: this removes the first item matching the provided item found. If - * the same item has been added multiple times, it will not remove other - * instances. - * - * @param mixed $datum - * @return bool False if the item was not found, true otherwise. - */ - public function remove($datum) - { - $found = false; - foreach ($this->items as $key => $item) { - if ($item['data'] === $datum) { - $found = true; - break; - } - } - if ($found) { - unset($this->items[$key]); - $this->queue = null; - - if (! $this->isEmpty()) { - $queue = $this->getQueue(); - foreach ($this->items as $item) { - $queue->insert($item['data'], $item['priority']); - } - } - return true; - } - return false; - } - - /** - * Is the queue empty? - * - * @return bool - */ - public function isEmpty() - { - return (0 === $this->count()); - } - - /** - * How many items are in the queue? - * - * @return int - */ - public function count() - { - return count($this->items); - } - - /** - * Peek at the top node in the queue, based on priority. - * - * @return mixed - */ - public function top() - { - return $this->getIterator()->top(); - } - - /** - * Extract a node from the inner queue and sift up - * - * @return mixed - */ - public function extract() - { - return $this->getQueue()->extract(); - } - - /** - * Retrieve the inner iterator - * - * SplPriorityQueue acts as a heap, which typically implies that as items - * are iterated, they are also removed. This does not work for situations - * where the queue may be iterated multiple times. As such, this class - * aggregates the values, and also injects an SplPriorityQueue. This method - * retrieves the inner queue object, and clones it for purposes of - * iteration. - * - * @return SplPriorityQueue - */ - public function getIterator() - { - $queue = $this->getQueue(); - return clone $queue; - } - - /** - * Serialize the data structure - * - * @return string - */ - public function serialize() - { - return serialize($this->items); - } - - /** - * Unserialize a string into a PriorityQueue object - * - * Serialization format is compatible with {@link Zend\Stdlib\SplPriorityQueue} - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->insert($item['data'], $item['priority']); - } - } - - /** - * Serialize to an array - * - * By default, returns only the item data, and in the order registered (not - * sorted). You may provide one of the EXTR_* flags as an argument, allowing - * the ability to return priorities or both data and priority. - * - * @param int $flag - * @return array - */ - public function toArray($flag = self::EXTR_DATA) - { - switch ($flag) { - case self::EXTR_BOTH: - return $this->items; - case self::EXTR_PRIORITY: - return array_map(function ($item) { - return $item['priority']; - }, $this->items); - case self::EXTR_DATA: - default: - return array_map(function ($item) { - return $item['data']; - }, $this->items); - } - } - - /** - * Specify the internal queue class - * - * Please see {@link getIterator()} for details on the necessity of an - * internal queue class. The class provided should extend SplPriorityQueue. - * - * @param string $class - * @return PriorityQueue - */ - public function setInternalQueueClass($class) - { - $this->queueClass = (string) $class; - return $this; - } - - /** - * Does the queue contain the given datum? - * - * @param mixed $datum - * @return bool - */ - public function contains($datum) - { - foreach ($this->items as $item) { - if ($item['data'] === $datum) { - return true; - } - } - return false; - } - - /** - * Does the queue have an item with the given priority? - * - * @param int $priority - * @return bool - */ - public function hasPriority($priority) - { - foreach ($this->items as $item) { - if ($item['priority'] === $priority) { - return true; - } - } - return false; - } - - /** - * Get the inner priority queue instance - * - * @throws Exception\DomainException - * @return SplPriorityQueue - */ - protected function getQueue() - { - if (null === $this->queue) { - $this->queue = new $this->queueClass(); - if (! $this->queue instanceof \SplPriorityQueue) { - throw new Exception\DomainException(sprintf( - 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', - get_class($this->queue) - )); - } - } - return $this->queue; - } - - /** - * Add support for deep cloning - * - * @return void - */ - public function __clone() - { - if (null !== $this->queue) { - $this->queue = clone $this->queue; - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/Request.php b/bundled-libs/zendframework/zend-stdlib/src/Request.php deleted file mode 100644 index 7c084039..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/Request.php +++ /dev/null @@ -1,15 +0,0 @@ -serial--]; - } - parent::insert($datum, $priority); - } - - /** - * Serialize to an array - * - * Array will be priority => data pairs - * - * @return array - */ - public function toArray() - { - $array = []; - foreach (clone $this as $item) { - $array[] = $item; - } - return $array; - } - - /** - * Serialize - * - * @return string - */ - public function serialize() - { - $clone = clone $this; - $clone->setExtractFlags(self::EXTR_BOTH); - - $data = []; - foreach ($clone as $item) { - $data[] = $item; - } - - return serialize($data); - } - - /** - * Deserialize - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - $this->serial = PHP_INT_MAX; - foreach (unserialize($data) as $item) { - $this->serial--; - $this->insert($item['data'], $item['priority']); - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/SplQueue.php b/bundled-libs/zendframework/zend-stdlib/src/SplQueue.php deleted file mode 100644 index 51d8daf7..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/SplQueue.php +++ /dev/null @@ -1,55 +0,0 @@ -toArray()); - } - - /** - * Unserialize - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->push($item); - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/SplStack.php b/bundled-libs/zendframework/zend-stdlib/src/SplStack.php deleted file mode 100644 index 6ba27398..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/SplStack.php +++ /dev/null @@ -1,55 +0,0 @@ -toArray()); - } - - /** - * Unserialize - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->unshift($item); - } - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringUtils.php b/bundled-libs/zendframework/zend-stdlib/src/StringUtils.php deleted file mode 100644 index 79a22a4c..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringUtils.php +++ /dev/null @@ -1,187 +0,0 @@ -setEncoding($encoding, $convertEncoding); - return $wrapper; - } - } - - throw new Exception\RuntimeException( - 'No wrapper found supporting "' . $encoding . '"' - . (($convertEncoding !== null) ? ' and "' . $convertEncoding . '"' : '') - ); - } - - /** - * Get a list of all known single-byte character encodings - * - * @return string[] - */ - public static function getSingleByteEncodings() - { - return static::$singleByteEncodings; - } - - /** - * Check if a given encoding is a known single-byte character encoding - * - * @param string $encoding - * @return bool - */ - public static function isSingleByteEncoding($encoding) - { - return in_array(strtoupper($encoding), static::$singleByteEncodings); - } - - /** - * Check if a given string is valid UTF-8 encoded - * - * @param string $str - * @return bool - */ - public static function isValidUtf8($str) - { - return is_string($str) && ($str === '' || preg_match('/^./su', $str) == 1); - } - - /** - * Is PCRE compiled with Unicode support? - * - * @return bool - */ - public static function hasPcreUnicodeSupport() - { - if (static::$hasPcreUnicodeSupport === null) { - ErrorHandler::start(); - static::$hasPcreUnicodeSupport = defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1; - ErrorHandler::stop(); - } - return static::$hasPcreUnicodeSupport; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php b/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php deleted file mode 100644 index cf262507..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php +++ /dev/null @@ -1,269 +0,0 @@ -convertEncoding = $convertEncodingUpper; - } else { - $this->convertEncoding = null; - } - $this->encoding = $encodingUpper; - - return $this; - } - - /** - * Get the defined character encoding to work with - * - * @return string - * @throws Exception\LogicException If no encoding was defined - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * Get the defined character encoding to convert to - * - * @return string|null - */ - public function getConvertEncoding() - { - return $this->convertEncoding; - } - - /** - * Convert a string from defined character encoding to the defined convert encoding - * - * @param string $str - * @param bool $reverse - * @return string|false - */ - public function convert($str, $reverse = false) - { - $encoding = $this->getEncoding(); - $convertEncoding = $this->getConvertEncoding(); - if ($convertEncoding === null) { - throw new Exception\LogicException( - 'No convert encoding defined' - ); - } - - if ($encoding === $convertEncoding) { - return $str; - } - - $from = $reverse ? $convertEncoding : $encoding; - $to = $reverse ? $encoding : $convertEncoding; - throw new Exception\RuntimeException(sprintf( - 'Converting from "%s" to "%s" isn\'t supported by this string wrapper', - $from, - $to - )); - } - - /** - * Wraps a string to a given number of characters - * - * @param string $string - * @param int $width - * @param string $break - * @param bool $cut - * @return string|false - */ - public function wordWrap($string, $width = 75, $break = "\n", $cut = false) - { - $string = (string) $string; - if ($string === '') { - return ''; - } - - $break = (string) $break; - if ($break === '') { - throw new Exception\InvalidArgumentException('Break string cannot be empty'); - } - - $width = (int) $width; - if ($width === 0 && $cut) { - throw new Exception\InvalidArgumentException('Cannot force cut when width is zero'); - } - - if (StringUtils::isSingleByteEncoding($this->getEncoding())) { - return wordwrap($string, $width, $break, $cut); - } - - $stringWidth = $this->strlen($string); - $breakWidth = $this->strlen($break); - - $result = ''; - $lastStart = $lastSpace = 0; - - for ($current = 0; $current < $stringWidth; $current++) { - $char = $this->substr($string, $current, 1); - - $possibleBreak = $char; - if ($breakWidth !== 1) { - $possibleBreak = $this->substr($string, $current, $breakWidth); - } - - if ($possibleBreak === $break) { - $result .= $this->substr($string, $lastStart, $current - $lastStart + $breakWidth); - $current += $breakWidth - 1; - $lastStart = $lastSpace = $current + 1; - continue; - } - - if ($char === ' ') { - if ($current - $lastStart >= $width) { - $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; - $lastStart = $current + 1; - } - - $lastSpace = $current; - continue; - } - - if ($current - $lastStart >= $width && $cut && $lastStart >= $lastSpace) { - $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; - $lastStart = $lastSpace = $current; - continue; - } - - if ($current - $lastStart >= $width && $lastStart < $lastSpace) { - $result .= $this->substr($string, $lastStart, $lastSpace - $lastStart) . $break; - $lastStart = $lastSpace = $lastSpace + 1; - continue; - } - } - - if ($lastStart !== $current) { - $result .= $this->substr($string, $lastStart, $current - $lastStart); - } - - return $result; - } - - /** - * Pad a string to a certain length with another string - * - * @param string $input - * @param int $padLength - * @param string $padString - * @param int $padType - * @return string - */ - public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT) - { - if (StringUtils::isSingleByteEncoding($this->getEncoding())) { - return str_pad($input, $padLength, $padString, $padType); - } - - $lengthOfPadding = $padLength - $this->strlen($input); - if ($lengthOfPadding <= 0) { - return $input; - } - - $padStringLength = $this->strlen($padString); - if ($padStringLength === 0) { - return $input; - } - - $repeatCount = floor($lengthOfPadding / $padStringLength); - - if ($padType === STR_PAD_BOTH) { - $repeatCountLeft = $repeatCountRight = ($repeatCount - $repeatCount % 2) / 2; - - $lastStringLength = $lengthOfPadding - 2 * $repeatCountLeft * $padStringLength; - $lastStringLeftLength = $lastStringRightLength = floor($lastStringLength / 2); - $lastStringRightLength += $lastStringLength % 2; - - $lastStringLeft = $this->substr($padString, 0, $lastStringLeftLength); - $lastStringRight = $this->substr($padString, 0, $lastStringRightLength); - - return str_repeat($padString, $repeatCountLeft) . $lastStringLeft - . $input - . str_repeat($padString, $repeatCountRight) . $lastStringRight; - } - - $lastString = $this->substr($padString, 0, $lengthOfPadding % $padStringLength); - - if ($padType === STR_PAD_LEFT) { - return str_repeat($padString, $repeatCount) . $lastString . $input; - } - - return $input . str_repeat($padString, $repeatCount) . $lastString; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Iconv.php b/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Iconv.php deleted file mode 100644 index bc791b89..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Iconv.php +++ /dev/null @@ -1,289 +0,0 @@ -getEncoding()); - } - - /** - * Returns the portion of string specified by the start and length parameters - * - * @param string $str - * @param int $offset - * @param int|null $length - * @return string|false - */ - public function substr($str, $offset = 0, $length = null) - { - return iconv_substr($str, $offset, $length, $this->getEncoding()); - } - - /** - * Find the position of the first occurrence of a substring in a string - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @return int|false - */ - public function strpos($haystack, $needle, $offset = 0) - { - return iconv_strpos($haystack, $needle, $offset, $this->getEncoding()); - } - - /** - * Convert a string from defined encoding to the defined convert encoding - * - * @param string $str - * @param bool $reverse - * @return string|false - */ - public function convert($str, $reverse = false) - { - $encoding = $this->getEncoding(); - $convertEncoding = $this->getConvertEncoding(); - if ($convertEncoding === null) { - throw new Exception\LogicException( - 'No convert encoding defined' - ); - } - - if ($encoding === $convertEncoding) { - return $str; - } - - $fromEncoding = $reverse ? $convertEncoding : $encoding; - $toEncoding = $reverse ? $encoding : $convertEncoding; - - // automatically add "//IGNORE" to not stop converting on invalid characters - // invalid characters triggers a notice anyway - return iconv($fromEncoding, $toEncoding . '//IGNORE', $str); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Intl.php b/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Intl.php deleted file mode 100644 index 4644db36..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Intl.php +++ /dev/null @@ -1,88 +0,0 @@ -getEncoding()); - } - - /** - * Returns the portion of string specified by the start and length parameters - * - * @param string $str - * @param int $offset - * @param int|null $length - * @return string|false - */ - public function substr($str, $offset = 0, $length = null) - { - return mb_substr($str, $offset, $length, $this->getEncoding()); - } - - /** - * Find the position of the first occurrence of a substring in a string - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @return int|false - */ - public function strpos($haystack, $needle, $offset = 0) - { - return mb_strpos($haystack, $needle, $offset, $this->getEncoding()); - } - - /** - * Convert a string from defined encoding to the defined convert encoding - * - * @param string $str - * @param bool $reverse - * @return string|false - */ - public function convert($str, $reverse = false) - { - $encoding = $this->getEncoding(); - $convertEncoding = $this->getConvertEncoding(); - - if ($convertEncoding === null) { - throw new Exception\LogicException( - 'No convert encoding defined' - ); - } - - if ($encoding === $convertEncoding) { - return $str; - } - - $fromEncoding = $reverse ? $convertEncoding : $encoding; - $toEncoding = $reverse ? $encoding : $convertEncoding; - return mb_convert_encoding($str, $toEncoding, $fromEncoding); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Native.php b/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Native.php deleted file mode 100644 index b01bb86c..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/Native.php +++ /dev/null @@ -1,134 +0,0 @@ -convertEncoding = $encodingUpper; - } - - if ($convertEncoding !== null) { - if ($encodingUpper !== strtoupper($convertEncoding)) { - throw new Exception\InvalidArgumentException( - 'Wrapper doesn\'t support to convert between character encodings' - ); - } - - $this->convertEncoding = $encodingUpper; - } else { - $this->convertEncoding = null; - } - $this->encoding = $encodingUpper; - - return $this; - } - - /** - * Returns the length of the given string - * - * @param string $str - * @return int|false - */ - public function strlen($str) - { - return strlen($str); - } - - /** - * Returns the portion of string specified by the start and length parameters - * - * @param string $str - * @param int $offset - * @param int|null $length - * @return string|false - */ - public function substr($str, $offset = 0, $length = null) - { - return substr($str, $offset, $length); - } - - /** - * Find the position of the first occurrence of a substring in a string - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @return int|false - */ - public function strpos($haystack, $needle, $offset = 0) - { - return strpos($haystack, $needle, $offset); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php b/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php deleted file mode 100644 index f25b3253..00000000 --- a/bundled-libs/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php +++ /dev/null @@ -1,111 +0,0 @@ -assertEquals(ArrayObject::STD_PROP_LIST, $ar->getFlags()); - $this->assertEquals('ArrayIterator', $ar->getIteratorClass()); - $this->assertInstanceOf('ArrayIterator', $ar->getIterator()); - $this->assertSame([], $ar->getArrayCopy()); - $this->assertEquals(0, $ar->count()); - } - - public function testConstructorParameters() - { - $ar = new ArrayObject(['foo' => 'bar'], ArrayObject::ARRAY_AS_PROPS, 'RecursiveArrayIterator'); - $this->assertEquals(ArrayObject::ARRAY_AS_PROPS, $ar->getFlags()); - $this->assertEquals('RecursiveArrayIterator', $ar->getIteratorClass()); - $this->assertInstanceOf('RecursiveArrayIterator', $ar->getIterator()); - $this->assertSame(['foo' => 'bar'], $ar->getArrayCopy()); - $this->assertEquals(1, $ar->count()); - $this->assertSame('bar', $ar->foo); - $this->assertSame('bar', $ar['foo']); - } - - public function testStdPropList() - { - $ar = new ArrayObject(); - $ar->foo = 'bar'; - $ar->bar = 'baz'; - $this->assertSame('bar', $ar->foo); - $this->assertSame('baz', $ar->bar); - $this->assertFalse(isset($ar['foo'])); - $this->assertFalse(isset($ar['bar'])); - $this->assertEquals(0, $ar->count()); - $this->assertSame([], $ar->getArrayCopy()); - } - - public function testStdPropListCannotAccessObjectVars() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(); - $ar->flag; - } - - public function testStdPropListStillHandlesArrays() - { - $ar = new ArrayObject(); - $ar->foo = 'bar'; - $ar['foo'] = 'baz'; - - $this->assertSame('bar', $ar->foo); - $this->assertSame('baz', $ar['foo']); - $this->assertEquals(1, $ar->count()); - } - - public function testArrayAsProps() - { - $ar = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - $ar->foo = 'bar'; - $ar['foo'] = 'baz'; - $ar->bar = 'foo'; - $ar['baz'] = 'bar'; - - $this->assertSame('baz', $ar->foo); - $this->assertSame('baz', $ar['foo']); - $this->assertSame($ar->foo, $ar['foo']); - $this->assertEquals(3, $ar->count()); - } - - public function testAppend() - { - $ar = new ArrayObject(['one', 'two']); - $this->assertEquals(2, $ar->count()); - - $ar->append('three'); - - $this->assertSame('three', $ar[2]); - $this->assertEquals(3, $ar->count()); - } - - public function testAsort() - { - $ar = new ArrayObject(['d' => 'lemon', 'a' => 'orange', 'b' => 'banana', 'c' => 'apple']); - $sorted = $ar->getArrayCopy(); - asort($sorted); - $ar->asort(); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - /** - * PHPUnit 5.7 does not namespace error classes; retrieve appropriate one - * based on what is available. - * - * @return string - */ - protected function getExpectedWarningClass() - { - return class_exists(Warning::class) ? Warning::class : \PHPUnit_Framework_Error_Warning::class; - } - - public function testCount() - { - if (PHP_VERSION_ID >= 70200) { - $this->expectException($this->getExpectedWarningClass()); - $this->expectExceptionMessage('Parameter must be an array or an object that implements Countable'); - } - $ar = new ArrayObject(new TestAsset\ArrayObjectObjectVars()); - $this->assertCount(1, $ar); - } - - public function testCountable() - { - $ar = new ArrayObject(new TestAsset\ArrayObjectObjectCount()); - $this->assertCount(42, $ar); - } - - public function testExchangeArray() - { - $ar = new ArrayObject(['foo' => 'bar']); - $old = $ar->exchangeArray(['bar' => 'baz']); - - $this->assertSame(['foo' => 'bar'], $old); - $this->assertSame(['bar' => 'baz'], $ar->getArrayCopy()); - } - - public function testExchangeArrayPhpArrayObject() - { - $ar = new ArrayObject(['foo' => 'bar']); - $old = $ar->exchangeArray(new \ArrayObject(['bar' => 'baz'])); - - $this->assertSame(['foo' => 'bar'], $old); - $this->assertSame(['bar' => 'baz'], $ar->getArrayCopy()); - } - - public function testExchangeArrayStdlibArrayObject() - { - $ar = new ArrayObject(['foo' => 'bar']); - $old = $ar->exchangeArray(new ArrayObject(['bar' => 'baz'])); - - $this->assertSame(['foo' => 'bar'], $old); - $this->assertSame(['bar' => 'baz'], $ar->getArrayCopy()); - } - - public function testExchangeArrayTestAssetIterator() - { - $ar = new ArrayObject(); - $ar->exchangeArray(new TestAsset\ArrayObjectIterator(['foo' => 'bar'])); - - // make sure it does what php array object does: - $ar2 = new \ArrayObject(); - $ar2->exchangeArray(new TestAsset\ArrayObjectIterator(['foo' => 'bar'])); - - $this->assertEquals($ar2->getArrayCopy(), $ar->getArrayCopy()); - } - - public function testExchangeArrayArrayIterator() - { - $ar = new ArrayObject(); - $ar->exchangeArray(new \ArrayIterator(['foo' => 'bar'])); - - $this->assertEquals(['foo' => 'bar'], $ar->getArrayCopy()); - } - - public function testExchangeArrayStringArgumentFail() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(['foo' => 'bar']); - $old = $ar->exchangeArray('Bacon'); - } - - public function testGetArrayCopy() - { - $ar = new ArrayObject(['foo' => 'bar']); - $this->assertSame(['foo' => 'bar'], $ar->getArrayCopy()); - } - - public function testFlags() - { - $ar = new ArrayObject(); - $this->assertEquals(ArrayObject::STD_PROP_LIST, $ar->getFlags()); - $ar = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - $this->assertEquals(ArrayObject::ARRAY_AS_PROPS, $ar->getFlags()); - - $ar->setFlags(ArrayObject::STD_PROP_LIST); - $this->assertEquals(ArrayObject::STD_PROP_LIST, $ar->getFlags()); - $ar->setFlags(ArrayObject::ARRAY_AS_PROPS); - $this->assertEquals(ArrayObject::ARRAY_AS_PROPS, $ar->getFlags()); - } - - public function testIterator() - { - $ar = new ArrayObject(['1' => 'one', '2' => 'two', '3' => 'three']); - $iterator = $ar->getIterator(); - $iterator2 = new \ArrayIterator($ar->getArrayCopy()); - $this->assertEquals($iterator2->getArrayCopy(), $iterator->getArrayCopy()); - } - - public function testIteratorClass() - { - $ar = new ArrayObject([], ArrayObject::STD_PROP_LIST, 'RecursiveArrayIterator'); - $this->assertEquals('RecursiveArrayIterator', $ar->getIteratorClass()); - $ar = new ArrayObject([], ArrayObject::STD_PROP_LIST, 'ArrayIterator'); - $this->assertEquals('ArrayIterator', $ar->getIteratorClass()); - $ar->setIteratorClass('RecursiveArrayIterator'); - $this->assertEquals('RecursiveArrayIterator', $ar->getIteratorClass()); - $ar->setIteratorClass('ArrayIterator'); - $this->assertEquals('ArrayIterator', $ar->getIteratorClass()); - } - - public function testInvalidIteratorClassThrowsInvalidArgumentException() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject([], ArrayObject::STD_PROP_LIST, 'InvalidArrayIterator'); - } - - public function testKsort() - { - $ar = new ArrayObject(['d' => 'lemon', 'a' => 'orange', 'b' => 'banana', 'c' => 'apple']); - $sorted = $ar->getArrayCopy(); - ksort($sorted); - $ar->ksort(); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - public function testNatcasesort() - { - $ar = new ArrayObject(['IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png']); - $sorted = $ar->getArrayCopy(); - natcasesort($sorted); - $ar->natcasesort(); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - public function testNatsort() - { - $ar = new ArrayObject(['img12.png', 'img10.png', 'img2.png', 'img1.png']); - $sorted = $ar->getArrayCopy(); - natsort($sorted); - $ar->natsort(); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - public function testOffsetExists() - { - $ar = new ArrayObject(); - $ar['foo'] = 'bar'; - $ar->bar = 'baz'; - - $this->assertTrue($ar->offsetExists('foo')); - $this->assertFalse($ar->offsetExists('bar')); - $this->assertTrue(isset($ar->bar)); - $this->assertFalse(isset($ar->foo)); - } - - public function testOffsetExistsThrowsExceptionOnProtectedProperty() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(); - isset($ar->protectedProperties); - } - - public function testOffsetGetOffsetSet() - { - $ar = new ArrayObject(); - $ar['foo'] = 'bar'; - $ar->bar = 'baz'; - - $this->assertSame('bar', $ar['foo']); - $this->assertSame('baz', $ar->bar); - $this->assertFalse(isset($ar->unknown)); - $this->assertFalse(isset($ar['unknown'])); - } - - public function testOffsetGetThrowsExceptionOnProtectedProperty() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(); - $ar->protectedProperties; - } - - public function testOffsetSetThrowsExceptionOnProtectedProperty() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(); - $ar->protectedProperties = null; - } - - public function testOffsetUnset() - { - $ar = new ArrayObject(); - $ar['foo'] = 'bar'; - $ar->bar = 'foo'; - unset($ar['foo']); - unset($ar->bar); - $this->assertFalse(isset($ar['foo'])); - $this->assertFalse(isset($ar->bar)); - $this->assertSame([], $ar->getArrayCopy()); - } - - public function testOffsetUnsetMultidimensional() - { - $ar = new ArrayObject(); - $ar['foo'] = ['bar' => ['baz' => 'boo']]; - unset($ar['foo']['bar']['baz']); - - $this->assertArrayNotHasKey('baz', $ar['foo']['bar']); - } - - public function testOffsetUnsetThrowsExceptionOnProtectedProperty() - { - $this->expectException(InvalidArgumentException::class); - $ar = new ArrayObject(); - unset($ar->protectedProperties); - } - - public function testSerializeUnserialize() - { - $ar = new ArrayObject(); - $ar->foo = 'bar'; - $ar['bar'] = 'foo'; - $serialized = $ar->serialize(); - - $ar = new ArrayObject(); - $ar->unserialize($serialized); - - $this->assertSame('bar', $ar->foo); - $this->assertSame('foo', $ar['bar']); - } - - public function testUasort() - { - $function = function ($a, $b) { - if ($a == $b) { - return 0; - } - - return ($a < $b) ? -1 : 1; - }; - $ar = new ArrayObject(['a' => 4, 'b' => 8, 'c' => -1, 'd' => -9, 'e' => 2, 'f' => 5, 'g' => 3, 'h' => -4]); - $sorted = $ar->getArrayCopy(); - uasort($sorted, $function); - $ar->uasort($function); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - public function testUksort() - { - $function = function ($a, $b) { - $a = preg_replace('@^(a|an|the) @', '', $a); - $b = preg_replace('@^(a|an|the) @', '', $b); - - return strcasecmp($a, $b); - }; - - $ar = new ArrayObject(['John' => 1, 'the Earth' => 2, 'an apple' => 3, 'a banana' => 4]); - $sorted = $ar->getArrayCopy(); - uksort($sorted, $function); - $ar->uksort($function); - $this->assertSame($sorted, $ar->getArrayCopy()); - } - - /** - * @group 6089 - */ - public function testSerializationRestoresProperties() - { - $ar = new ArrayObject(); - $ar->foo = 'bar'; - $ar['bar'] = 'foo'; - - $this->assertEquals($ar, unserialize(serialize($ar))); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/ArrayUtilsTest.php b/bundled-libs/zendframework/zend-stdlib/test/ArrayUtilsTest.php deleted file mode 100644 index 907503ac..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/ArrayUtilsTest.php +++ /dev/null @@ -1,521 +0,0 @@ - 'bar' - ]], - [[ - '15', - 'foo' => 'bar', - 'baz' => ['baz'] - ]], - [[ - 0 => false, - 2 => null - ]], - [[ - -100 => 'foo', - 100 => 'bar' - ]], - [[ - 1 => 0 - ]], - ]; - } - - public static function validLists() - { - return [ - [[null]], - [[true]], - [[false]], - [[0]], - [[-0.9999]], - [['string']], - [[new stdClass]], - [[ - 0 => 'foo', - 1 => 'bar', - 2 => false, - 3 => null, - 4 => [], - 5 => new stdClass() - ]] - ]; - } - - public static function validArraysWithStringKeys() - { - return [ - [[ - 'foo' => 'bar', - ]], - [[ - 'bar', - 'foo' => 'bar', - 'baz', - ]], - ]; - } - - public static function validArraysWithNumericKeys() - { - return [ - [[ - 'foo', - 'bar' - ]], - [[ - '0' => 'foo', - '1' => 'bar', - ]], - [[ - 'bar', - '1' => 'bar', - 3 => 'baz' - ]], - [[ - -10000 => null, - '-10000' => null, - ]], - [[ - '-00000.00009' => 'foo' - ]], - [[ - 1 => 0 - ]], - ]; - } - - public static function validArraysWithIntegerKeys() - { - return [ - [[ - 'foo', - 'bar,' - ]], - [[ - 100 => 'foo', - 200 => 'bar' - ]], - [[ - -100 => 'foo', - 0 => 'bar', - 100 => 'baz' - ]], - [[ - 'foo', - 'bar', - 1000 => 'baz' - ]], - ]; - } - - public static function invalidArrays() - { - return [ - [new stdClass()], - [15], - ['foo'], - [new ArrayObject()], - ]; - } - - public static function mergeArrays() - { - return [ - 'merge-integer-and-string-keys' => [ - [ - 'foo', - 3 => 'bar', - 'baz' => 'baz', - 4 => [ - 'a', - 1 => 'b', - 'c', - ], - ], - [ - 'baz', - 4 => [ - 'd' => 'd', - ], - ], - false, - [ - 0 => 'foo', - 3 => 'bar', - 'baz' => 'baz', - 4 => [ - 'a', - 1 => 'b', - 'c', - ], - 5 => 'baz', - 6 => [ - 'd' => 'd', - ], - ] - ], - 'merge-integer-and-string-keys-preserve-numeric' => [ - [ - 'foo', - 3 => 'bar', - 'baz' => 'baz', - 4 => [ - 'a', - 1 => 'b', - 'c', - ], - ], - [ - 'baz', - 4 => [ - 'd' => 'd', - ], - ], - true, - [ - 0 => 'baz', - 3 => 'bar', - 'baz' => 'baz', - 4 => [ - 'a', - 1 => 'b', - 'c', - 'd' => 'd', - ], - ] - ], - 'merge-arrays-recursively' => [ - [ - 'foo' => [ - 'baz' - ] - ], - [ - 'foo' => [ - 'baz' - ] - ], - false, - [ - 'foo' => [ - 0 => 'baz', - 1 => 'baz' - ] - ] - ], - 'replace-string-keys' => [ - [ - 'foo' => 'bar', - 'bar' => [] - ], - [ - 'foo' => 'baz', - 'bar' => 'bat' - ], - false, - [ - 'foo' => 'baz', - 'bar' => 'bat' - ] - ], - 'merge-with-null' => [ - [ - 'foo' => null, - null => 'rod', - 'cat' => 'bar', - 'god' => 'rad' - ], - [ - 'foo' => 'baz', - null => 'zad', - 'god' => null - ], - false, - [ - 'foo' => 'baz', - null => 'zad', - 'cat' => 'bar', - 'god' => null - ] - ], - ]; - } - - /** - * @group 6903 - */ - public function testMergeReplaceKey() - { - $expected = [ - 'car' => [ - 'met' => 'bet', - ], - 'new' => [ - 'foo' => 'get', - ], - ]; - $a = [ - 'car' => [ - 'boo' => 'foo', - 'doo' => 'moo', - ], - ]; - $b = [ - 'car' => new \Zend\Stdlib\ArrayUtils\MergeReplaceKey([ - 'met' => 'bet', - ]), - 'new' => new \Zend\Stdlib\ArrayUtils\MergeReplaceKey([ - 'foo' => 'get', - ]), - ]; - $this->assertInstanceOf('Zend\Stdlib\ArrayUtils\MergeReplaceKeyInterface', $b['car']); - $this->assertEquals($expected, ArrayUtils::merge($a, $b)); - } - - /** - * @group 6899 - */ - public function testAllowsRemovingKeys() - { - $a = [ - 'foo' => 'bar', - 'bar' => 'bat' - ]; - $b = [ - 'foo' => new MergeRemoveKey(), - 'baz' => new MergeRemoveKey(), - ]; - $expected = [ - 'bar' => 'bat' - ]; - $this->assertEquals($expected, ArrayUtils::merge($a, $b)); - } - - public static function validIterators() - { - $array = [ - 'foo' => [ - 'bar' => [ - 'baz' => [ - 'baz' => 'bat', - ], - ], - ], - ]; - $arrayAccess = new ArrayObject($array); - $toArray = new Parameters($array); - - return [ - // Description => [input, expected array] - 'array' => [$array, $array], - 'Traversable' => [$arrayAccess, $array], - 'Traversable and toArray' => [$toArray, $array], - ]; - } - - public static function invalidIterators() - { - return [ - [null], - [true], - [false], - [0], - [1], - [0.0], - [1.0], - ['string'], - [new stdClass], - ]; - } - - /** - * @dataProvider validArraysWithStringKeys - */ - public function testValidArraysWithStringKeys($test) - { - $this->assertTrue(ArrayUtils::hasStringKeys($test)); - } - - /** - * @dataProvider validArraysWithIntegerKeys - */ - public function testValidArraysWithIntegerKeys($test) - { - $this->assertTrue(ArrayUtils::hasIntegerKeys($test)); - } - - /** - * @dataProvider validArraysWithNumericKeys - */ - public function testValidArraysWithNumericKeys($test) - { - $this->assertTrue(ArrayUtils::hasNumericKeys($test)); - } - - /** - * @dataProvider invalidArrays - */ - public function testInvalidArraysAlwaysReturnFalse($test) - { - $this->assertFalse(ArrayUtils::hasStringKeys($test, false)); - $this->assertFalse(ArrayUtils::hasIntegerKeys($test, false)); - $this->assertFalse(ArrayUtils::hasNumericKeys($test, false)); - $this->assertFalse(ArrayUtils::isList($test, false)); - $this->assertFalse(ArrayUtils::isHashTable($test, false)); - - $this->assertFalse(ArrayUtils::hasStringKeys($test, false)); - $this->assertFalse(ArrayUtils::hasIntegerKeys($test, false)); - $this->assertFalse(ArrayUtils::hasNumericKeys($test, false)); - $this->assertFalse(ArrayUtils::isList($test, false)); - $this->assertFalse(ArrayUtils::isHashTable($test, false)); - } - - /** - * @dataProvider validLists - */ - public function testLists($test) - { - $this->assertTrue(ArrayUtils::isList($test)); - $this->assertTrue(ArrayUtils::hasIntegerKeys($test)); - $this->assertTrue(ArrayUtils::hasNumericKeys($test)); - $this->assertFalse(ArrayUtils::hasStringKeys($test)); - $this->assertFalse(ArrayUtils::isHashTable($test)); - } - - /** - * @dataProvider validHashTables - */ - public function testHashTables($test) - { - $this->assertTrue(ArrayUtils::isHashTable($test)); - $this->assertFalse(ArrayUtils::isList($test)); - } - - public function testEmptyArrayReturnsTrue() - { - $test = []; - $this->assertTrue(ArrayUtils::hasStringKeys($test, true)); - $this->assertTrue(ArrayUtils::hasIntegerKeys($test, true)); - $this->assertTrue(ArrayUtils::hasNumericKeys($test, true)); - $this->assertTrue(ArrayUtils::isList($test, true)); - $this->assertTrue(ArrayUtils::isHashTable($test, true)); - } - - public function testEmptyArrayReturnsFalse() - { - $test = []; - $this->assertFalse(ArrayUtils::hasStringKeys($test, false)); - $this->assertFalse(ArrayUtils::hasIntegerKeys($test, false)); - $this->assertFalse(ArrayUtils::hasNumericKeys($test, false)); - $this->assertFalse(ArrayUtils::isList($test, false)); - $this->assertFalse(ArrayUtils::isHashTable($test, false)); - } - - /** - * @dataProvider mergeArrays - */ - public function testMerge($a, $b, $preserveNumericKeys, $expected) - { - $this->assertEquals($expected, ArrayUtils::merge($a, $b, $preserveNumericKeys)); - } - - /** - * @dataProvider validIterators - */ - public function testValidIteratorsReturnArrayRepresentation($test, $expected) - { - $result = ArrayUtils::iteratorToArray($test); - $this->assertEquals($expected, $result); - } - - /** - * @dataProvider invalidIterators - */ - public function testInvalidIteratorsRaiseInvalidArgumentException($test) - { - $this->expectException(InvalidArgumentException::class); - $this->assertFalse(ArrayUtils::iteratorToArray($test)); - } - - public function filterArrays() - { - return [ - [ - ['foo' => 'bar', 'fiz' => 'buz'], - function ($value) { - if ($value == 'bar') { - return false; - } - return true; - }, - null, - ['fiz' => 'buz'] - ], - [ - ['foo' => 'bar', 'fiz' => 'buz'], - function ($value, $key) { - if ($value == 'buz') { - return false; - } - - if ($key == 'foo') { - return false; - } - - return true; - }, - ArrayUtils::ARRAY_FILTER_USE_BOTH, - [] - ], - [ - ['foo' => 'bar', 'fiz' => 'buz'], - function ($key) { - if ($key == 'foo') { - return false; - } - return true; - }, - ArrayUtils::ARRAY_FILTER_USE_KEY, - ['fiz' => 'buz'] - ], - ]; - } - - /** - * @dataProvider filterArrays - */ - public function testFiltersArray($data, $callback, $flag, $result) - { - $this->assertEquals($result, ArrayUtils::filter($data, $callback, $flag)); - } - - public function testInvalidCallableRaiseInvalidArgumentException() - { - $this->expectException(InvalidArgumentException::class); - ArrayUtils::filter([], "INVALID"); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/ConsoleHelperTest.php b/bundled-libs/zendframework/zend-stdlib/test/ConsoleHelperTest.php deleted file mode 100644 index 276276ef..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/ConsoleHelperTest.php +++ /dev/null @@ -1,148 +0,0 @@ -helper = new ConsoleHelper(); - } - - public function disableColorSupport() - { - $r = new ReflectionProperty($this->helper, 'supportsColor'); - $r->setAccessible(true); - $r->setValue($this->helper, false); - } - - public function enableColorSupport() - { - $r = new ReflectionProperty($this->helper, 'supportsColor'); - $r->setAccessible(true); - $r->setValue($this->helper, true); - } - - public function overrideEolSequence($newSequence) - { - $r = new ReflectionProperty($this->helper, 'eol'); - $r->setAccessible(true); - $r->setValue($this->helper, $newSequence); - } - - public function overrideStderrResource($stderr) - { - $r = new ReflectionProperty($this->helper, 'stderr'); - $r->setAccessible(true); - $r->setValue($this->helper, $stderr); - } - - public function retrieveStreamContents($stream) - { - rewind($stream); - $contents = ''; - while (! feof($stream)) { - $contents .= fread($stream, 4096); - } - return $contents; - } - - public function testCanColorizeInfoString() - { - $string = ' -h|--help This help message'; - $this->enableColorSupport(); - $colorized = $this->helper->colorize($string); - - $this->assertEquals(" \033[32m-h|--help\033[0m This help message", $colorized); - } - - public function testCanColorizeErrorString() - { - $string = 'NOT OK An error occurred'; - $this->enableColorSupport(); - $colorized = $this->helper->colorize($string); - - $this->assertEquals("\033[31mNOT OK\033[0m An error occurred", $colorized); - } - - public function testCanColorizeMixedStrings() - { - $this->enableColorSupport(); - $string = "NOT OK\n\nUsage: foo"; - $colorized = $this->helper->colorize($string); - - $this->assertContains("\033[31mNOT OK\033[0m", $colorized, 'Colorized error string not found'); - $this->assertContains("\033[32mUsage:\033[0m", $colorized, 'Colorized info string not found'); - } - - public function testColorizationWillReplaceTagsWithEmptyStringsWhenColorSupportIsNotDetected() - { - $this->disableColorSupport(); - $string = "NOT OK\n\nUsage: foo"; - $colorized = $this->helper->colorize($string); - - $this->assertNotContains("\033[31m", $colorized, 'Colorized error string discovered'); - $this->assertNotContains("\033[32m", $colorized, 'Colorized info string discovered'); - $this->assertNotContains("\033[0m", $colorized, 'Color reset sequence discovered'); - $this->assertNotRegexp("/<\/?error>/", $colorized, 'Error template string discovered'); - $this->assertNotRegexp("/<\/?info>/", $colorized, 'Info template string discovered'); - } - - public function testWriteFormatsLinesToPhpEolSequenceAndWritesToProvidedStream() - { - $this->overrideEolSequence("\r\n"); - $string = "foo bar\nbaz bat"; - $stream = fopen('php://temp', 'w+'); - - $this->helper->write($string, false, $stream); - - $contents = $this->retrieveStreamContents($stream); - $this->assertContains("\r\n", $contents); - } - - public function testWriteWillColorizeOutputIfRequested() - { - $this->enableColorSupport(); - $string = 'foo bar'; - $stream = fopen('php://temp', 'w+'); - - $this->helper->write($string, true, $stream); - - $contents = $this->retrieveStreamContents($stream); - $this->assertContains("\033[32mbar\033[0m", $contents); - } - - public function testWriteLineAppendsPhpEolSequenceToString() - { - $this->overrideEolSequence("\r\n"); - $string = 'foo bar'; - $stream = fopen('php://temp', 'w+'); - - $this->helper->writeLine($string, false, $stream); - - $contents = $this->retrieveStreamContents($stream); - $this->assertRegexp("/bar\r\n$/", $contents); - } - - public function testWriteErrorMessageWritesColorizedOutputToStderr() - { - $stderr = fopen('php://temp', 'w+'); - $this->overrideStderrResource($stderr); - $this->enableColorSupport(); - $this->overrideEolSequence("\r\n"); - - $this->helper->writeErrorMessage('an error occurred'); - - $contents = $this->retrieveStreamContents($stderr); - $this->assertEquals("\033[31man error occurred\033[0m\r\n\r\n", $contents); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/ErrorHandlerTest.php b/bundled-libs/zendframework/zend-stdlib/test/ErrorHandlerTest.php deleted file mode 100644 index 2a00c64b..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/ErrorHandlerTest.php +++ /dev/null @@ -1,105 +0,0 @@ -assertSame(0, ErrorHandler::getNestedLevel()); - - ErrorHandler::start(); - $this->assertSame(1, ErrorHandler::getNestedLevel()); - - ErrorHandler::start(); - $this->assertSame(2, ErrorHandler::getNestedLevel()); - - ErrorHandler::stop(); - $this->assertSame(1, ErrorHandler::getNestedLevel()); - - ErrorHandler::stop(); - $this->assertSame(0, ErrorHandler::getNestedLevel()); - } - - public function testClean() - { - ErrorHandler::start(); - $this->assertSame(1, ErrorHandler::getNestedLevel()); - - ErrorHandler::start(); - $this->assertSame(2, ErrorHandler::getNestedLevel()); - - ErrorHandler::clean(); - $this->assertSame(0, ErrorHandler::getNestedLevel()); - } - - public function testStarted() - { - $this->assertFalse(ErrorHandler::started()); - - ErrorHandler::start(); - $this->assertTrue(ErrorHandler::started()); - - ErrorHandler::stop(); - $this->assertFalse(ErrorHandler::started()); - } - - public function testReturnCatchedError() - { - ErrorHandler::start(); - strpos(); // Invalid argument list - $err = ErrorHandler::stop(); - - $this->assertInstanceOf('ErrorException', $err); - } - - public function testThrowCatchedError() - { - ErrorHandler::start(); - strpos(); // Invalid argument list - - $this->expectException(ErrorException::class); - ErrorHandler::stop(true); - } - - public function testAddError() - { - ErrorHandler::start(); - ErrorHandler::addError(1, 'test-msg1', 'test-file1', 100); - ErrorHandler::addError(2, 'test-msg2', 'test-file2', 200); - $err = ErrorHandler::stop(); - - $this->assertInstanceOf('ErrorException', $err); - $this->assertEquals('test-file2', $err->getFile()); - $this->assertEquals('test-msg2', $err->getMessage()); - $this->assertEquals(200, $err->getLine()); - $this->assertEquals(0, $err->getCode()); - $this->assertEquals(2, $err->getSeverity()); - - $previous = $err->getPrevious(); - $this->assertInstanceOf('ErrorException', $previous); - $this->assertEquals('test-file1', $previous->getFile()); - $this->assertEquals('test-msg1', $previous->getMessage()); - $this->assertEquals(100, $previous->getLine()); - $this->assertEquals(0, $previous->getCode()); - $this->assertEquals(1, $previous->getSeverity()); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/FastPriorityQueueTest.php b/bundled-libs/zendframework/zend-stdlib/test/FastPriorityQueueTest.php deleted file mode 100644 index 867519bf..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/FastPriorityQueueTest.php +++ /dev/null @@ -1,348 +0,0 @@ -queue = new FastPriorityQueue(); - $this->insertDataQueue($this->queue); - $this->expected = [ - 'test1', - 'test2', - 'test3', - 'test4', - 'test5', - 'test6' - ]; - } - - protected function getDataPriorityQueue() - { - return [ - 'test3' => -1, - 'test5' => -10, - 'test1' => 5, - 'test2' => 2, - 'test4' => -1, - 'test6' => -10 - ]; - } - - protected function insertDataQueue(FastPriorityQueue $queue) - { - foreach ($this->getDataPriorityQueue() as $value => $priority) { - $queue->insert($value, $priority); - } - } - - /** - * Test the insert and extract operations for the queue - * We test that extract() function remove the elements - */ - public function testInsertExtract() - { - foreach ($this->expected as $value) { - $this->assertEquals($value, $this->queue->extract()); - } - // We check that the elements are removed from the queue - $this->assertTrue($this->queue->isEmpty()); - } - - public function testIteratePreserveElements() - { - $i = 0; - foreach ($this->queue as $value) { - $this->assertEquals($this->expected[$i++], $value); - } - // We check that the elements still exist in the queue - $i = 0; - foreach ($this->queue as $value) { - $this->assertEquals($this->expected[$i++], $value); - } - } - - public function testMaintainsInsertOrderForDataOfEqualPriority() - { - $queue = new FastPriorityQueue(); - $queue->insert('foo', 1000); - $queue->insert('bar', 1000); - $queue->insert('baz', 1000); - $queue->insert('bat', 1000); - - $expected = ['foo', 'bar', 'baz', 'bat']; - $test = []; - foreach ($queue as $datum) { - $test[] = $datum; - } - $this->assertEquals($expected, $test); - } - - public function testSerializationAndDeserializationShouldMaintainState() - { - $s = serialize($this->queue); - $unserialized = unserialize($s); - $count = count($this->queue); - $this->assertSame( - $count, - count($unserialized), - 'Expected count ' . $count . '; received ' . count($unserialized) - ); - - $expected = []; - foreach ($this->queue as $item) { - $expected[] = $item; - } - $test = []; - foreach ($unserialized as $item) { - $test[] = $item; - } - $this->assertSame( - $expected, - $test, - 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1) - ); - } - - public function testCanRetrieveQueueAsArray() - { - $test = $this->queue->toArray(); - $this->assertSame($this->expected, $test, var_export($test, 1)); - } - - public function testIteratorFunctions() - { - $this->assertEquals($this->expected, iterator_to_array($this->queue)); - } - - public function testRewindOperation() - { - $this->assertEquals(0, $this->queue->key()); - $this->queue->next(); - $this->assertEquals(1, $this->queue->key()); - $this->queue->rewind(); - $this->assertEquals(0, $this->queue->key()); - } - - public function testSetExtractFlag() - { - $priorities = $this->getDataPriorityQueue(); - $this->queue->setExtractFlags(FastPriorityQueue::EXTR_DATA); - $this->assertEquals($this->expected[0], $this->queue->extract()); - $this->queue->setExtractFlags(FastPriorityQueue::EXTR_PRIORITY); - $this->assertEquals($priorities[$this->expected[1]], $this->queue->extract()); - $this->queue->setExtractFlags(FastPriorityQueue::EXTR_BOTH); - $expected = [ - 'data' => $this->expected[2], - 'priority' => $priorities[$this->expected[2]] - ]; - $this->assertEquals($expected, $this->queue->extract()); - } - - public function testSetInvalidExtractFlag() - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('The extract flag specified is not valid'); - $this->queue->setExtractFlags('foo'); - } - - public function testIsEmpty() - { - $queue = new FastPriorityQueue(); - $this->assertTrue($queue->isEmpty()); - $queue->insert('foo', 1); - $this->assertFalse($queue->isEmpty()); - $value = $queue->extract(); - $this->assertTrue($queue->isEmpty()); - } - - public function testContains() - { - foreach ($this->expected as $value) { - $this->assertTrue($this->queue->contains($value)); - } - $this->assertFalse($this->queue->contains('foo')); - } - - public function testHasPriority() - { - foreach ($this->getDataPriorityQueue() as $value => $priority) { - $this->assertTrue($this->queue->hasPriority($priority)); - } - $this->assertFalse($this->queue->hasPriority(10000)); - } - - public function testCanRemoveItemFromQueue() - { - $this->assertTrue($this->queue->remove('test5')); - $tot = count($this->getDataPriorityQueue()) - 1; - $this->assertEquals($this->queue->count(), $tot); - $this->assertEquals(count($this->queue), $tot); - $expected = ['test1', 'test2', 'test3', 'test4', 'test6']; - $test = []; - foreach ($this->queue as $item) { - $test[] = $item; - } - $this->assertEquals($expected, $test); - } - - public function testRemoveOnlyTheFirstOccurenceFromQueue() - { - $data = $this->getDataPriorityQueue(); - $this->queue->insert('test2', $data['test2']); - $tot = count($this->getDataPriorityQueue()) + 1; - $this->assertEquals($this->queue->count(), $tot); - $this->assertEquals(count($this->queue), $tot); - - $expected = ['test1', 'test2', 'test2', 'test3', 'test4', 'test5', 'test6']; - $test = []; - foreach ($this->queue as $item) { - $test[] = $item; - } - $this->assertEquals($expected, $test); - - $this->assertTrue($this->queue->remove('test2')); - $this->assertEquals($this->queue->count(), $tot - 1); - $this->assertEquals(count($this->queue), $tot - 1); - $test = []; - foreach ($this->queue as $item) { - $test[] = $item; - } - $this->assertEquals($this->expected, $test); - } - - public function testRewindShouldNotRaiseErrorWhenQueueIsEmpty() - { - $queue = new FastPriorityQueue(); - $this->assertTrue($queue->isEmpty()); - - $queue->rewind(); - } - - public function testRemoveShouldFindItemEvenIfMultipleItemsAreInQueue() - { - $prototype = function ($e) { - }; - - $queue = new FastPriorityQueue(); - $this->assertTrue($queue->isEmpty()); - - $listeners = []; - for ($i = 0; $i < 5; $i += 1) { - $listeners[] = $listener = clone $prototype; - $queue->insert($listener, 1); - } - - $remove = array_rand(array_keys($listeners)); - $listener = $listeners[$remove]; - - $this->assertTrue($queue->contains($listener)); - $this->assertTrue($queue->remove($listener)); - $this->assertFalse($queue->contains($listener)); - } - - public function testIterativelyRemovingItemsShouldRemoveAllItems() - { - $prototype = function ($e) { - }; - - $queue = new FastPriorityQueue(); - $this->assertTrue($queue->isEmpty()); - - $listeners = []; - for ($i = 0; $i < 5; $i += 1) { - $listeners[] = $listener = clone $prototype; - $queue->insert($listener, 1); - } - - for ($i = 0; $i < 5; $i += 1) { - $listener = $listeners[$i]; - $queue->remove($listener); - } - - for ($i = 0; $i < 5; $i += 1) { - $listener = $listeners[$i]; - $this->assertFalse($queue->contains($listener), sprintf('Listener %s remained in queue', $i)); - } - } - - public function testRemoveShouldNotAffectExtract() - { - // Removing an element with low priority - $queue = new FastPriorityQueue(); - $queue->insert('a1', 1); - $queue->insert('a2', 1); - $queue->insert('b', 2); - $queue->remove('a1'); - $expected = ['b', 'a2']; - $test = []; - while ($value = $queue->extract()) { - $test[] = $value; - } - $this->assertEquals($expected, $test); - $this->assertTrue($queue->isEmpty()); - - // Removing an element in the middle of a set of elements with the same priority - $queue->insert('a1', 1); - $queue->insert('a2', 1); - $queue->insert('a3', 1); - $queue->remove('a2'); - $expected = ['a1', 'a3']; - $test = []; - while ($value = $queue->extract()) { - $test[] = $value; - } - $this->assertEquals($expected, $test); - $this->assertTrue($queue->isEmpty()); - - // Removing an element with high priority - $queue->insert('a', 1); - $queue->insert('b', 2); - $queue->remove('b'); - $expected = ['a']; - $test = []; - while ($value = $queue->extract()) { - $test[] = $value; - } - $this->assertEquals($expected, $test); - $this->assertTrue($queue->isEmpty()); - } - - public function testZeroPriority() - { - $queue = new FastPriorityQueue(); - $queue->insert('a', 0); - $queue->insert('b', 1); - $expected = ['b', 'a']; - $test = []; - foreach ($queue as $value) { - $test[] = $value; - } - $this->assertEquals($expected, $test); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/GlobTest.php b/bundled-libs/zendframework/zend-stdlib/test/GlobTest.php deleted file mode 100644 index 4650ccce..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/GlobTest.php +++ /dev/null @@ -1,73 +0,0 @@ -markTestSkipped('GLOB_BRACE not available'); - } - - $this->assertEquals( - glob(__DIR__ . '/_files/{alph,bet}a', GLOB_BRACE), - Glob::glob(__DIR__ . '/_files/{alph,bet}a', Glob::GLOB_BRACE, true) - ); - } - - public function testNonMatchingGlobReturnsArray() - { - $result = Glob::glob('/some/path/{,*.}{this,orthis}.php', Glob::GLOB_BRACE); - $this->assertInternalType('array', $result); - } - - public function testThrowExceptionOnError() - { - $this->expectException(RuntimeException::class); - - // run into a max path length error - $path = '/' . str_repeat('a', 10000); - Glob::glob($path); - } - - /** - * @param string $pattern - * - * @dataProvider patternsProvider - */ - public function testPatterns($pattern, $expectedSequence) - { - $result = Glob::glob(__DIR__ . '/_files/' . $pattern, Glob::GLOB_BRACE); - - $this->assertCount(count($expectedSequence), $result); - - foreach ($expectedSequence as $i => $expectedFileName) { - $this->assertStringEndsWith($expectedFileName, $result[$i]); - } - } - - public function patternsProvider() - { - return [ - [ - "{{,*.}alph,{,*.}bet}a", - [ - 'alpha', 'eta.alpha', 'zeta.alpha', 'beta', 'eta.beta', - 'zeta.beta' - ] - ] - ]; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/Guard/ArrayOrTraversableGuardTraitTest.php b/bundled-libs/zendframework/zend-stdlib/test/Guard/ArrayOrTraversableGuardTraitTest.php deleted file mode 100644 index db16ac75..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/Guard/ArrayOrTraversableGuardTraitTest.php +++ /dev/null @@ -1,42 +0,0 @@ -expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Argument must be an array or Traversable, [string] given'); - $object->setArrayOrTraversable(''); - } - - public function testGuardForArrayOrTraversableAllowsArray() - { - $object = new GuardedObject; - $this->assertNull($object->setArrayOrTraversable([])); - } - - public function testGuardForArrayOrTraversableAllowsTraversable() - { - $object = new GuardedObject; - $traversable = new ArrayObject; - $this->assertNull($object->setArrayOrTraversable($traversable)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/Guard/EmptyGuardTraitTest.php b/bundled-libs/zendframework/zend-stdlib/test/Guard/EmptyGuardTraitTest.php deleted file mode 100644 index f0889a7c..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/Guard/EmptyGuardTraitTest.php +++ /dev/null @@ -1,34 +0,0 @@ -expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Argument cannot be empty'); - $object->setNotEmpty(''); - } - - public function testGuardAgainstEmptyAllowsNonEmptyString() - { - $object = new GuardedObject; - $this->assertNull($object->setNotEmpty('foo')); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/Guard/NullGuardTraitTest.php b/bundled-libs/zendframework/zend-stdlib/test/Guard/NullGuardTraitTest.php deleted file mode 100644 index 2d6a774d..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/Guard/NullGuardTraitTest.php +++ /dev/null @@ -1,35 +0,0 @@ -expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Argument cannot be null'); - - $object->setNotNull(null); - } - - public function testGuardAgainstNullAllowsNonNull() - { - $object = new GuardedObject; - $this->assertNull($object->setNotNull('foo')); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/MessageTest.php b/bundled-libs/zendframework/zend-stdlib/test/MessageTest.php deleted file mode 100644 index 9148d154..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/MessageTest.php +++ /dev/null @@ -1,73 +0,0 @@ -setContent('I can set content'); - $this->assertInstanceOf('Zend\Stdlib\Message', $ret); - $this->assertEquals('I can set content', $message->getContent()); - } - - public function testMessageCanSetAndGetMetadataKeyAsString() - { - $message = new Message(); - $ret = $message->setMetadata('foo', 'bar'); - $this->assertInstanceOf('Zend\Stdlib\Message', $ret); - $this->assertEquals('bar', $message->getMetadata('foo')); - $this->assertEquals(['foo' => 'bar'], $message->getMetadata()); - } - - public function testMessageCanSetAndGetMetadataKeyAsArray() - { - $message = new Message(); - $ret = $message->setMetadata(['foo' => 'bar']); - $this->assertInstanceOf('Zend\Stdlib\Message', $ret); - $this->assertEquals('bar', $message->getMetadata('foo')); - } - - public function testMessageGetMetadataWillUseDefaultValueIfNoneExist() - { - $message = new Message(); - $this->assertEquals('bar', $message->getMetadata('foo', 'bar')); - } - - public function testMessageThrowsExceptionOnInvalidKeyForMetadataSet() - { - $message = new Message(); - - $this->expectException(InvalidArgumentException::class); - $message->setMetadata(new \stdClass()); - } - - public function testMessageThrowsExceptionOnInvalidKeyForMetadataGet() - { - $message = new Message(); - - $this->expectException(InvalidArgumentException::class); - $message->getMetadata(new \stdClass()); - } - - public function testMessageToStringWorks() - { - $message = new Message(); - $message->setMetadata(['Foo' => 'bar', 'One' => 'Two']); - $message->setContent('This is my content'); - $expected = "Foo: bar\r\nOne: Two\r\n\r\nThis is my content"; - $this->assertEquals($expected, $message->toString()); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/OptionsTest.php b/bundled-libs/zendframework/zend-stdlib/test/OptionsTest.php deleted file mode 100644 index 82f0557f..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/OptionsTest.php +++ /dev/null @@ -1,205 +0,0 @@ - 1]); - - $this->assertEquals(1, $options->test_field); - } - - public function testConstructionWithTraversable() - { - $config = new ArrayObject(['test_field' => 1]); - $options = new TestOptions($config); - - $this->assertEquals(1, $options->test_field); - } - - public function testConstructionWithOptions() - { - $options = new TestOptions(new TestOptions(['test_field' => 1])); - - $this->assertEquals(1, $options->test_field); - } - - public function testInvalidFieldThrowsException() - { - $this->expectException(BadMethodCallException::class); - - new TestOptions(['foo' => 'bar']); - } - - public function testNonStrictOptionsDoesNotThrowException() - { - $this->assertInstanceOf( - 'ZendTest\Stdlib\TestAsset\TestOptionsNoStrict', - new TestOptionsNoStrict(['foo' => 'bar']) - ); - } - - public function testConstructionWithNull() - { - $this->assertInstanceOf('ZendTest\Stdlib\TestAsset\TestOptions', new TestOptions(null)); - } - - public function testUnsetting() - { - $options = new TestOptions(['test_field' => 1]); - - $this->assertEquals(true, isset($options->test_field)); - unset($options->testField); - $this->assertEquals(false, isset($options->test_field)); - } - - public function testUnsetThrowsInvalidArgumentException() - { - $options = new TestOptions; - - $this->expectException(InvalidArgumentException::class); - - unset($options->foobarField); - } - - public function testGetThrowsBadMethodCallException() - { - $options = new TestOptions(); - - $this->expectException(BadMethodCallException::class); - - $options->fieldFoobar; - } - - public function testSetFromArrayAcceptsArray() - { - $array = ['test_field' => 3]; - $options = new TestOptions(); - - $this->assertSame($options, $options->setFromArray($array)); - $this->assertEquals(3, $options->test_field); - } - - public function testSetFromArrayThrowsInvalidArgumentException() - { - $this->expectException(InvalidArgumentException::class); - $options = new TestOptions; - $options->setFromArray('asd'); - } - - public function testParentPublicProperty() - { - $options = new TestOptionsDerived(['parent_public' => 1]); - - $this->assertEquals(1, $options->parent_public); - } - - public function testParentProtectedProperty() - { - $options = new TestOptionsDerived(['parent_protected' => 1]); - - $this->assertEquals(1, $options->parent_protected); - } - - public function testParentPrivateProperty() - { - $this->expectException(Exception\BadMethodCallException::class); - $this->expectExceptionMessage( - 'The option "parent_private" does not have a callable "setParentPrivate" ("setparentprivate")' - . ' setter method which must be defined' - ); - - new TestOptionsDerived(['parent_private' => 1]); - } - - public function testDerivedPublicProperty() - { - $options = new TestOptionsDerived(['derived_public' => 1]); - - $this->assertEquals(1, $options->derived_public); - } - - public function testDerivedProtectedProperty() - { - $options = new TestOptionsDerived(['derived_protected' => 1]); - - $this->assertEquals(1, $options->derived_protected); - } - - public function testDerivedPrivateProperty() - { - $this->expectException(Exception\BadMethodCallException::class); - $this->expectExceptionMessage( - 'The option "derived_private" does not have a callable "setDerivedPrivate" ("setderivedprivate")' - .' setter method which must be defined' - ); - - new TestOptionsDerived(['derived_private' => 1]); - } - - public function testExceptionMessageContainsActualUsedSetter() - { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessage( - 'The option "foo bar" does not have a callable "setFooBar" ("setfoo bar")' - . ' setter method which must be defined' - ); - - new TestOptions([ - 'foo bar' => 'baz', - ]); - } - - /** - * @group 7287 - */ - public function testIssetReturnsFalseWhenMatchingGetterDoesNotExist() - { - $options = new TestOptionsWithoutGetter([ - 'foo' => 'bar', - ]); - $this->assertFalse(isset($options->foo)); - } - - /** - * @group 7287 - */ - public function testIssetDoesNotThrowExceptionWhenMatchingGetterDoesNotExist() - { - $options = new TestOptionsWithoutGetter(); - - isset($options->foo); - - $this->addToAssertionCount(1); - } - - /** - * @group 7287 - */ - public function testIssetReturnsTrueWithValidDataWhenMatchingGetterDoesNotExist() - { - $options = new TestOptions([ - 'test_field' => 1, - ]); - $this->assertTrue(isset($options->testField)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/ParametersTest.php b/bundled-libs/zendframework/zend-stdlib/test/ParametersTest.php deleted file mode 100644 index 40b1d69e..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/ParametersTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertInstanceOf('Zend\Stdlib\ParametersInterface', $parameters); - $this->assertInstanceOf('ArrayObject', $parameters); - $this->assertInstanceOf('ArrayAccess', $parameters); - $this->assertInstanceOf('Countable', $parameters); - $this->assertInstanceOf('Serializable', $parameters); - $this->assertInstanceOf('Traversable', $parameters); - } - - public function testParametersPersistNameAndValues() - { - $parameters = new Parameters(['foo' => 'bar']); - $this->assertEquals('bar', $parameters['foo']); - $this->assertEquals('bar', $parameters->foo); - $parameters->offsetSet('baz', 5); - $this->assertEquals(5, $parameters->baz); - - $parameters->fromArray(['bar' => 'foo']); - $this->assertEquals('foo', $parameters->bar); - - $parameters->fromString('bar=foo&five=5'); - $this->assertEquals('foo', $parameters->bar); - $this->assertEquals('5', $parameters->five); - $this->assertEquals(['bar' => 'foo', 'five' => '5'], $parameters->toArray()); - $this->assertEquals('bar=foo&five=5', $parameters->toString()); - - $parameters->fromArray([]); - $parameters->set('foof', 'barf'); - $this->assertEquals('barf', $parameters->get('foof')); - $this->assertEquals('barf', $parameters->foof); - } - - public function testParametersOffsetgetReturnsNullIfNonexistentKeyIsProvided() - { - $parameters = new Parameters; - $this->assertNull($parameters->foo); - } - - public function testParametersGetReturnsDefaultValueIfNonExistent() - { - $parameters = new Parameters(); - - $this->assertEquals(5, $parameters->get('nonExistentProp', 5)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/PriorityListTest.php b/bundled-libs/zendframework/zend-stdlib/test/PriorityListTest.php deleted file mode 100644 index d60ace94..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/PriorityListTest.php +++ /dev/null @@ -1,244 +0,0 @@ -list = new PriorityList(); - } - - public function testInsert() - { - $this->list->insert('foo', new \stdClass(), 0); - - $this->assertEquals(1, count($this->list)); - - foreach ($this->list as $key => $value) { - $this->assertEquals('foo', $key); - } - } - - public function testInsertDuplicates() - { - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - - $this->assertEquals(2, count($this->list)); - - $this->list->insert('foo', new \stdClass()); - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - - $this->assertEquals(2, count($this->list)); - - $this->list->remove('foo'); - - $this->assertEquals(1, count($this->list)); - } - - public function testRemove() - { - $this->list->insert('foo', new \stdClass(), 0); - $this->list->insert('bar', new \stdClass(), 0); - - $this->assertEquals(2, count($this->list)); - - $this->list->remove('foo'); - - $this->assertEquals(1, count($this->list)); - } - - public function testRemovingNonExistentRouteDoesNotYieldError() - { - $this->list->remove('foo'); - - $this->assertEmpty($this->list); - } - - public function testClear() - { - $this->list->insert('foo', new \stdClass(), 0); - $this->list->insert('bar', new \stdClass(), 0); - - $this->assertEquals(2, count($this->list)); - - $this->list->clear(); - - $this->assertEquals(0, count($this->list)); - $this->assertSame(false, $this->list->current()); - } - - public function testGet() - { - $route = new \stdClass(); - - $this->list->insert('foo', $route, 0); - - $this->assertEquals($route, $this->list->get('foo')); - $this->assertNull($this->list->get('bar')); - } - - public function testLIFOOnly() - { - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - $this->list->insert('baz', new \stdClass()); - $this->list->insert('foobar', new \stdClass()); - $this->list->insert('barbaz', new \stdClass()); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['barbaz', 'foobar', 'baz', 'bar', 'foo'], $orders); - } - - public function testPriorityOnly() - { - $this->list->insert('foo', new \stdClass(), 1); - $this->list->insert('bar', new \stdClass(), 0); - $this->list->insert('baz', new \stdClass(), 2); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['baz', 'foo', 'bar'], $orders); - } - - public function testLIFOWithPriority() - { - $this->list->insert('foo', new \stdClass(), 0); - $this->list->insert('bar', new \stdClass(), 0); - $this->list->insert('baz', new \stdClass(), 1); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['baz', 'bar', 'foo'], $orders); - } - - public function testFIFOWithPriority() - { - $this->list->isLIFO(false); - $this->list->insert('foo', new \stdClass(), 0); - $this->list->insert('bar', new \stdClass(), 0); - $this->list->insert('baz', new \stdClass(), 1); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['baz', 'foo', 'bar'], $orders); - } - - public function testFIFOOnly() - { - $this->list->isLIFO(false); - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - $this->list->insert('baz', new \stdClass()); - $this->list->insert('foobar', new \stdClass()); - $this->list->insert('barbaz', new \stdClass()); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['foo', 'bar', 'baz', 'foobar', 'barbaz'], $orders); - } - - public function testPriorityWithNegativesAndNull() - { - $this->list->insert('foo', new \stdClass(), null); - $this->list->insert('bar', new \stdClass(), 1); - $this->list->insert('baz', new \stdClass(), -1); - - $orders = array_keys(iterator_to_array($this->list)); - - $this->assertEquals(['bar', 'foo', 'baz'], $orders); - } - - public function testCurrent() - { - $this->list->insert('foo', 'foo_value', null); - $this->list->insert('bar', 'bar_value', 1); - $this->list->insert('baz', 'baz_value', -1); - - $this->assertEquals('bar', $this->list->key()); - $this->assertEquals('bar_value', $this->list->current()); - } - - public function testIterator() - { - $this->list->insert('foo', 'foo_value'); - $iterator = $this->list->getIterator(); - $this->assertEquals($iterator, $this->list); - - $this->list->insert('bar', 'bar_value'); - $this->assertNotEquals($iterator, $this->list); - } - - public function testToArray() - { - $this->list->insert('foo', 'foo_value', null); - $this->list->insert('bar', 'bar_value', 1); - $this->list->insert('baz', 'baz_value', -1); - - $this->assertEquals( - [ - 'bar' => 'bar_value', - 'foo' => 'foo_value', - 'baz' => 'baz_value' - ], - $this->list->toArray() - ); - - $this->assertEquals( - [ - 'bar' => ['data' => 'bar_value', 'priority' => 1, 'serial' => 1], - 'foo' => ['data' => 'foo_value', 'priority' => 0, 'serial' => 0], - 'baz' => ['data' => 'baz_value', 'priority' => -1, 'serial' => 2], - ], - $this->list->toArray(PriorityList::EXTR_BOTH) - ); - } - - /** - * @group 6768 - * @group 6773 - */ - public function testBooleanValuesAreValid() - { - $this->list->insert('null', null, null); - $this->list->insert('false', false, null); - $this->list->insert('string', 'test', 1); - $this->list->insert('true', true, -1); - - $orders1 = []; - $orders2 = []; - - foreach ($this->list as $key => $value) { - $orders1[$this->list->key()] = $this->list->current(); - $orders2[$key] = $value; - } - $this->assertEquals($orders1, $orders2); - $this->assertEquals( - [ - 'null' => null, - 'false' => false, - 'string' => 'test', - 'true' => true, - ], - $orders2 - ); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/PriorityQueueTest.php b/bundled-libs/zendframework/zend-stdlib/test/PriorityQueueTest.php deleted file mode 100644 index 4a49eb75..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/PriorityQueueTest.php +++ /dev/null @@ -1,164 +0,0 @@ -queue = new PriorityQueue(); - $this->queue->insert('foo', 3); - $this->queue->insert('bar', 4); - $this->queue->insert('baz', 2); - $this->queue->insert('bat', 1); - } - - public function testSerializationAndDeserializationShouldMaintainState() - { - $s = serialize($this->queue); - $unserialized = unserialize($s); - $count = count($this->queue); - $this->assertSame( - $count, - count($unserialized), - 'Expected count ' . $count . '; received ' . count($unserialized) - ); - - $expected = iterator_to_array($this->queue); - $test = iterator_to_array($unserialized); - $this->assertSame( - $expected, - $test, - 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1) - ); - } - - public function testRetrievingQueueAsArrayReturnsDataOnlyByDefault() - { - $expected = [ - 'foo', - 'bar', - 'baz', - 'bat', - ]; - $test = $this->queue->toArray(); - $this->assertSame($expected, $test, var_export($test, 1)); - } - - public function testCanCastToArrayOfPrioritiesOnly() - { - $expected = [ - 3, - 4, - 2, - 1, - ]; - $test = $this->queue->toArray(PriorityQueue::EXTR_PRIORITY); - $this->assertSame($expected, $test, var_export($test, 1)); - } - - public function testCanCastToArrayOfDataPriorityPairs() - { - $expected = [ - ['data' => 'foo', 'priority' => 3], - ['data' => 'bar', 'priority' => 4], - ['data' => 'baz', 'priority' => 2], - ['data' => 'bat', 'priority' => 1], - ]; - $test = $this->queue->toArray(PriorityQueue::EXTR_BOTH); - $this->assertSame($expected, $test, var_export($test, 1)); - } - - public function testCanIterateMultipleTimesAndReceiveSameResults() - { - $expected = ['bar', 'foo', 'baz', 'bat']; - - for ($i = 1; $i < 3; $i++) { - $test = []; - foreach ($this->queue as $item) { - $test[] = $item; - } - $this->assertEquals($expected, $test, 'Failed at iteration ' . $i); - } - } - - public function testCanRemoveItemFromQueue() - { - $this->queue->remove('baz'); - $expected = ['bar', 'foo', 'bat']; - $test = array_values(iterator_to_array($this->queue)); - $this->assertEquals($expected, $test); - } - - public function testCanTestForExistenceOfItemInQueue() - { - $this->assertTrue($this->queue->contains('foo')); - $this->assertFalse($this->queue->contains('foobar')); - } - - public function testCanTestForExistenceOfPriorityInQueue() - { - $this->assertTrue($this->queue->hasPriority(3)); - $this->assertFalse($this->queue->hasPriority(1000)); - } - - public function testCloningAlsoClonesQueue() - { - $foo = new \stdClass(); - $foo->name = 'bar'; - - $queue = new PriorityQueue(); - $queue->insert($foo, 1); - $queue->insert($foo, 2); - - $queueClone = clone $queue; - - while (! $queue->isEmpty()) { - $this->assertSame($foo, $queue->top()); - $queue->remove($queue->top()); - } - - $this->assertTrue($queue->isEmpty()); - $this->assertFalse($queueClone->isEmpty()); - $this->assertEquals(2, $queueClone->count()); - - while (! $queueClone->isEmpty()) { - $this->assertSame($foo, $queueClone->top()); - $queueClone->remove($queueClone->top()); - } - - $this->assertTrue($queueClone->isEmpty()); - } - - public function testQueueRevertsToInitialStateWhenEmpty() - { - $queue = new PriorityQueue(); - $testQueue = clone $queue; // store the default state - - $testQueue->insert('foo', 1); - $testQueue->insert('bar', 2); - - $testQueue->remove('foo'); - $testQueue->remove('bar'); - - $this->assertEquals($queue, $testQueue); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/SplPriorityQueueTest.php b/bundled-libs/zendframework/zend-stdlib/test/SplPriorityQueueTest.php deleted file mode 100644 index eb3b83d2..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/SplPriorityQueueTest.php +++ /dev/null @@ -1,73 +0,0 @@ -queue = new SplPriorityQueue(); - $this->queue->insert('foo', 3); - $this->queue->insert('bar', 4); - $this->queue->insert('baz', 2); - $this->queue->insert('bat', 1); - } - - public function testMaintainsInsertOrderForDataOfEqualPriority() - { - $queue = new SplPriorityQueue(); - $queue->insert('foo', 1000); - $queue->insert('bar', 1000); - $queue->insert('baz', 1000); - $queue->insert('bat', 1000); - - $expected = ['foo', 'bar', 'baz', 'bat']; - $test = array_values(iterator_to_array($queue)); - $this->assertEquals($expected, $test); - } - - public function testSerializationAndDeserializationShouldMaintainState() - { - $s = serialize($this->queue); - $unserialized = unserialize($s); - - // assert same size - $this->assertSameSize($this->queue, $unserialized); - - // assert same values - $this->assertSame(iterator_to_array($this->queue), iterator_to_array($unserialized)); - - // assert equal - $this->assertEquals($this->queue, $unserialized); - } - - public function testCanRetrieveQueueAsArray() - { - $expected = [ - 'bar', - 'foo', - 'baz', - 'bat', - ]; - $test = $this->queue->toArray(); - $this->assertSame($expected, $test, var_export($test, 1)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/SplQueueTest.php b/bundled-libs/zendframework/zend-stdlib/test/SplQueueTest.php deleted file mode 100644 index b1022b39..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/SplQueueTest.php +++ /dev/null @@ -1,50 +0,0 @@ -queue = new SplQueue(); - $this->queue->push('foo'); - $this->queue->push('bar'); - $this->queue->push('baz'); - } - - public function testSerializationAndDeserializationShouldMaintainState() - { - $s = serialize($this->queue); - $unserialized = unserialize($s); - $count = count($this->queue); - $this->assertSame($count, count($unserialized)); - - $expected = iterator_to_array($this->queue); - $test = iterator_to_array($unserialized); - $this->assertSame($expected, $test); - } - - public function testCanRetrieveQueueAsArray() - { - $expected = ['foo', 'bar', 'baz']; - $this->assertSame($expected, $this->queue->toArray()); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/SplStackTest.php b/bundled-libs/zendframework/zend-stdlib/test/SplStackTest.php deleted file mode 100644 index c9973096..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/SplStackTest.php +++ /dev/null @@ -1,52 +0,0 @@ -stack = new SplStack(); - $this->stack->push('foo'); - $this->stack->push('bar'); - $this->stack->push('baz'); - $this->stack->push('bat'); - } - - public function testSerializationAndDeserializationShouldMaintainState() - { - $s = serialize($this->stack); - $unserialized = unserialize($s); - $count = count($this->stack); - $this->assertSame($count, count($unserialized)); - - $expected = iterator_to_array($this->stack); - $test = iterator_to_array($unserialized); - $this->assertSame($expected, $test); - } - - public function testCanRetrieveQueueAsArray() - { - $expected = ['bat', 'baz', 'bar', 'foo']; - $test = $this->stack->toArray(); - $this->assertSame($expected, $test, var_export($test, 1)); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringUtilsTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringUtilsTest.php deleted file mode 100644 index c24d90a9..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringUtilsTest.php +++ /dev/null @@ -1,160 +0,0 @@ -assertTrue(StringUtils::isSingleByteEncoding($encoding)); - } - - public function getNonSingleByteEncodings() - { - return [ - ['UTf-8'], - ['UTf-16'], - ['usC-2'], - ['CESU-8'], - ]; - } - - /** - * @dataProvider getNonSingleByteEncodings - * @param string $encoding - */ - public function testIsSingleByteEncodingReturnsFalse($encoding) - { - $this->assertFalse(StringUtils::isSingleByteEncoding($encoding)); - } - - public function testGetWrapper() - { - $wrapper = StringUtils::getWrapper('ISO-8859-1'); - if (extension_loaded('mbstring')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\MbString', $wrapper); - } elseif (extension_loaded('iconv')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\Iconv', $wrapper); - } else { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\Native', $wrapper); - } - - try { - $wrapper = StringUtils::getWrapper('UTF-8'); - if (extension_loaded('intl')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\Intl', $wrapper); - } elseif (extension_loaded('mbstring')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\MbString', $wrapper); - } elseif (extension_loaded('iconv')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\Iconv', $wrapper); - } - } catch (Exception $e) { - if (extension_loaded('intl') - || extension_loaded('mbstring') - || extension_loaded('iconv') - ) { - $this->fail("Failed to get intl, mbstring or iconv wrapper for UTF-8"); - } - } - - try { - $wrapper = StringUtils::getWrapper('UTF-8', 'ISO-8859-1'); - if (extension_loaded('mbstring')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\MbString', $wrapper); - } elseif (extension_loaded('iconv')) { - $this->assertInstanceOf('Zend\Stdlib\StringWrapper\Iconv', $wrapper); - } - } catch (Exception $e) { - if (extension_loaded('mbstring') || extension_loaded('iconv')) { - $this->fail("Failed to get mbstring or iconv wrapper for UTF-8 and ISO-8859-1"); - } - } - } - - public function getUtf8StringValidity() - { - return [ - // valid - ['', true], - ["\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" - . "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" - . ' !"#$%&\'()*+,-./0123456789:;<=>?' - . '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_' - . '`abcdefghijklmnopqrstuvwxyz{|}~', - true - ], - - // invalid - [true, false], - [123, false], - [123.45, false], - ["\xFF", false], - ["\x90a", false], - ]; - } - - /** - * @dataProvider getUtf8StringValidity - * @param string $str - * @param bool $valid - */ - public function testIsValidUtf8($str, $valid) - { - $this->assertSame($valid, StringUtils::isValidUtf8($str)); - } - - public function testHasPcreUnicodeSupport() - { - ErrorHandler::start(); - $expected = defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1; - ErrorHandler::stop(); - - $this->assertSame($expected, StringUtils::hasPcreUnicodeSupport()); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/CommonStringWrapperTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/CommonStringWrapperTest.php deleted file mode 100644 index 41675267..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/CommonStringWrapperTest.php +++ /dev/null @@ -1,264 +0,0 @@ -getWrapper($encoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} not supported"); - } - - $result = $wrapper->strlen($str); - $this->assertSame($expected, $result); - } - - public function substrProvider() - { - return [ - ['ascii', 'abcdefghijkl', 1, 5, 'bcdef'], - ['utf-8', 'abcdefghijkl', 1, 5, 'bcdef'], - ['utf-8', 'äöüß', 1, 2, 'öü'], - ]; - } - - /** - * @dataProvider substrProvider - * - * @param string $encoding - * @param string $str - * @param int $offset - * @param int|null $length - * @param mixed $expected - */ - public function testSubstr($encoding, $str, $offset, $length, $expected) - { - $wrapper = $this->getWrapper($encoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} not supported"); - } - - $result = $wrapper->substr($str, $offset, $length); - $this->assertSame($expected, $result); - } - - public function strposProvider() - { - return [ - ['ascii', 'abcdefghijkl', 'g', 3, 6], - ['utf-8', 'abcdefghijkl', 'g', 3, 6], - ['utf-8', 'äöüß', 'ü', 1, 2], - ]; - } - - /** - * @dataProvider strposProvider - * - * @param string $encoding - * @param string $haystack - * @param string $needle - * @param int $offset - * @param mixed $expected - */ - public function testStrpos($encoding, $haystack, $needle, $offset, $expected) - { - $wrapper = $this->getWrapper($encoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} not supported"); - } - - $result = $wrapper->strpos($haystack, $needle, $offset); - $this->assertSame($expected, $result); - } - - public function convertProvider() - { - return [ - ['ascii', 'ascii', 'abc', 'abc'], - ['ascii', 'utf-8', 'abc', 'abc'], - ['utf-8', 'ascii', 'abc', 'abc'], - ['utf-8', 'iso-8859-15', '€', "\xA4"], - ['utf-8', 'iso-8859-16', '€', "\xA4"], // ISO-8859-16 is wrong @ mbstring - ]; - } - - /** - * @dataProvider convertProvider - * - * @param string $str - * @param string $encoding - * @param string $convertEncoding - * @param mixed $expected - */ - public function testConvert($encoding, $convertEncoding, $str, $expected) - { - $wrapper = $this->getWrapper($encoding, $convertEncoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} or {$convertEncoding} not supported"); - } - - $result = $wrapper->convert($str); - $this->assertSame($expected, $result); - - // backword - $result = $wrapper->convert($expected, true); - $this->assertSame($str, $result); - } - - public function wordWrapProvider() - { - // @codingStandardsIgnoreStart - return [ - // Standard cut tests - 'cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', true, 'äb üö cß'], - 'cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, ' ', true, 'äb üö c ß äb üö cß'], - 'cut-multi-line-short-words' => ['utf-8', 'Ä very long wöööööööööööörd.', 8, "\n", true, "Ä very\nlong\nwööööööö\nööööörd."], - 'cut-multi-line-with-previous-new-lines' => ['utf-8', "Ä very\nlong wöööööööööööörd.", 8, "\n", false, "Ä very\nlong\nwöööööööööööörd."], - 'long-break' => ['utf-8', "Ä very
long wöö
öööööööö
öörd.", 8, '
', false, "Ä very
long wöö
öööööööö
öörd."], - - // Alternative cut tests - 'cut-beginning-single-space' => ['utf-8', ' äüöäöü', 3, ' ', true, ' äüö äöü'], - 'cut-ending-single-space' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'cut-ending-single-space-with-non-space-divider' => ['utf-8', 'äöüäöü ', 3, '-', true, 'äöü-äöü-'], - 'cut-ending-two-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'no-cut-ending-single-space' => ['utf-8', '12345 ', 5, '-', false, '12345-'], - 'no-cut-ending-two-spaces' => ['utf-8', '12345 ', 5, '-', false, '12345- '], - 'cut-ending-three-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'cut-ending-two-breaks' => ['utf-8', 'äüöäöü--', 3, '-', true, 'äüö-äöü--'], - 'cut-tab' => ['utf-8', "äbü\töcß", 3, ' ', true, "äbü \töc ß"], - 'cut-new-line-with-space' => ['utf-8', "äbü\nößt", 3, ' ', true, "äbü \nöß t"], - 'cut-new-line-with-new-line' => ['utf-8', "äbü\nößte", 3, "\n", true, "äbü\nößt\ne"], - - // Break cut tests - 'cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', true, 'foobar-foofoofo-o'], - 'cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', true, 'foobar-foobar'], - 'cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', true, 'foobar-foobar'], - 'cut-break-within-end' => ['ascii', 'foobar-', 7, '-', true, 'foobar-'], - 'cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', true, 'fooba-r-fooba-r'], - - // Standard no-cut tests - 'no-cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', false, 'äbüöcß'], - 'no-cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, "\n", false, "äbüöc\nß\näbüöcß"], - 'no-cut-multi-word' => ['utf-8', 'äöü äöü äöü', 5, "\n", false, "äöü\näöü\näöü"], - - // Break no-cut tests - 'no-cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', false, 'foobar-foofoofoo'], - 'no-cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', false, 'foobar-foobar'], - 'no-cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', false, 'foobar-foobar'], - 'no-cut-break-within-end' => ['ascii', 'foobar-', 7, '-', false, 'foobar-'], - 'no-cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', false, 'foobar-foobar'], - ]; - // @codingStandardsIgnoreEnd - } - - /** - * @dataProvider wordWrapProvider - * - * @param string $encoding - * @param string $string - * @param int $width - * @param string $break - * @param bool $cut - * @param mixed $expected - */ - public function testWordWrap($encoding, $string, $width, $break, $cut, $expected) - { - $wrapper = $this->getWrapper($encoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} not supported"); - } - - $result = $wrapper->wordWrap($string, $width, $break, $cut); - $this->assertSame($expected, $result); - } - - public function testWordWrapInvalidArgument() - { - $wrapper = $this->getWrapper(); - if (! $wrapper) { - $this->fail("Can't instantiate wrapper"); - } - $this->expectException(Exception\InvalidArgumentException::class); - $this->expectExceptionMessage( - "Cannot force cut when width is zero" - ); - $wrapper->wordWrap('a', 0, "\n", true); - } - - public function strPadProvider() - { - return [ - // single-byte - 'left-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_LEFT, 'ooaaa'], - 'center-padding_single-byte' => ['ascii', 'aaa', 6, 'o', STR_PAD_BOTH, 'oaaaoo'], - 'right-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_RIGHT, 'aaaoo'], - - // multi-byte - 'left-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_LEFT, 'ööäää'], - 'center-padding_multi-byte' => ['utf-8', 'äää', 6, 'ö', STR_PAD_BOTH, 'öäääöö'], - 'right-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], - - // ZF-12186 - 'input-longer-than-pad-length' => ['utf-8', 'äääöö', 2, 'ö', STR_PAD_RIGHT, 'äääöö'], - 'input-same-as-pad-length' => ['utf-8', 'äääöö', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], - 'negative-pad-length' => ['utf-8', 'äääöö', -2, 'ö', STR_PAD_RIGHT, 'äääöö'], - ]; - } - - /** - * @dataProvider strPadProvider - * - * @param string $encoding - * @param string $input - * @param int $padLength - * @param string $padString - * @param int $padType - * @param mixed $expected - * - * @group ZF-12186 - */ - public function testStrPad($encoding, $input, $padLength, $padString, $padType, $expected) - { - $wrapper = $this->getWrapper($encoding); - if (! $wrapper) { - $this->markTestSkipped("Encoding {$encoding} not supported"); - } - - $result = $wrapper->strPad($input, $padLength, $padString, $padType); - $this->assertSame($expected, $result); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IconvTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IconvTest.php deleted file mode 100644 index 8138a02a..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IconvTest.php +++ /dev/null @@ -1,46 +0,0 @@ -fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { - $this->markTestSkipped('Missing ext/iconv'); - } - } - - parent::setUp(); - } - - protected function getWrapper($encoding = null, $convertEncoding = null) - { - if ($encoding === null) { - $supportedEncodings = Iconv::getSupportedEncodings(); - $encoding = array_shift($supportedEncodings); - } - - if (! Iconv::isSupported($encoding, $convertEncoding)) { - return false; - } - - $wrapper = new Iconv(); - $wrapper->setEncoding($encoding, $convertEncoding); - return $wrapper; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IntlTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IntlTest.php deleted file mode 100644 index 6bd6b577..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/IntlTest.php +++ /dev/null @@ -1,46 +0,0 @@ -fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { - $this->markTestSkipped('Missing ext/intl'); - } - } - - parent::setUp(); - } - - protected function getWrapper($encoding = null, $convertEncoding = null) - { - if ($encoding === null) { - $supportedEncodings = Intl::getSupportedEncodings(); - $encoding = array_shift($supportedEncodings); - } - - if (! Intl::isSupported($encoding, $convertEncoding)) { - return false; - } - - $wrapper = new Intl(); - $wrapper->setEncoding($encoding, $convertEncoding); - return $wrapper; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/MbStringTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/MbStringTest.php deleted file mode 100644 index 4b69b57c..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/MbStringTest.php +++ /dev/null @@ -1,46 +0,0 @@ -fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { - $this->markTestSkipped('Missing ext/mbstring'); - } - } - - parent::setUp(); - } - - protected function getWrapper($encoding = null, $convertEncoding = null) - { - if ($encoding === null) { - $supportedEncodings = MbString::getSupportedEncodings(); - $encoding = array_shift($supportedEncodings); - } - - if (! MbString::isSupported($encoding, $convertEncoding)) { - return false; - } - - $wrapper = new MbString(); - $wrapper->setEncoding($encoding, $convertEncoding); - return $wrapper; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/NativeTest.php b/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/NativeTest.php deleted file mode 100644 index d74090de..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/StringWrapper/NativeTest.php +++ /dev/null @@ -1,31 +0,0 @@ -setEncoding($encoding, $convertEncoding); - return $wrapper; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectIterator.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectIterator.php deleted file mode 100644 index 6c5bf886..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectIterator.php +++ /dev/null @@ -1,51 +0,0 @@ -var = $array; - } - } - - public function rewind() - { - reset($this->var); - } - - public function current() - { - return current($this->var); - } - - public function key() - { - return key($this->var); - } - - public function next() - { - return next($this->var); - } - - public function valid() - { - $key = key($this->var); - $var = ($key !== null && $key !== false); - - return $var; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectObjectCount.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectObjectCount.php deleted file mode 100644 index fef278f6..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/ArrayObjectObjectCount.php +++ /dev/null @@ -1,18 +0,0 @@ -data = [ - "foo" => "bar", - "bar" => "foo", - "blubb" => "baz", - "quo" => "blubb" - ]; - } - - /** - * Exchange internal values from provided array - * - * @param array $array - * @return void - */ - public function exchangeArray(array $array) - { - $this->data = $array; - } - - /** - * Return an array representation of the object - * - * @return array - */ - public function getArrayCopy() - { - return $this->data; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/GuardedObject.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/GuardedObject.php deleted file mode 100644 index f2735835..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/GuardedObject.php +++ /dev/null @@ -1,32 +0,0 @@ -guardForArrayOrTraversable($value); - } - - public function setNotEmpty($value) - { - $this->guardAgainstEmpty($value); - } - - public function setNotNull($value) - { - $this->guardAgainstNull($value); - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptions.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptions.php deleted file mode 100644 index 723586fd..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptions.php +++ /dev/null @@ -1,86 +0,0 @@ -testField = $value; - } - - public function getTestField() - { - return $this->testField; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - private function setParentPrivate($parentPrivate) - { - $this->parentPrivate = $parentPrivate; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - private function getParentPrivate() - { - return $this->parentPrivate; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - protected function setParentProtected($parentProtected) - { - $this->parentProtected = $parentProtected; - } - - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - protected function getParentProtected() - { - return $this->parentProtected; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - public function setParentPublic($parentPublic) - { - $this->parentPublic = $parentPublic; - } - - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - public function getParentPublic() - { - return $this->parentPublic; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsDerived.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsDerived.php deleted file mode 100644 index 07d3e385..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsDerived.php +++ /dev/null @@ -1,72 +0,0 @@ -derivedPrivate = $derivedPrivate; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - private function getDerivedPrivate() - { - return $this->derivedPrivate; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - protected function setDerivedProtected($derivedProtected) - { - $this->derivedProtected = $derivedProtected; - } - - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - protected function getDerivedProtected() - { - return $this->derivedProtected; - } - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - public function setDerivedPublic($derivedPublic) - { - $this->derivedPublic = $derivedPublic; - } - - - /** - * Needed to test accessibility of getters / setters within deriving classes - */ - public function getDerivedPublic() - { - return $this->derivedPublic; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsNoStrict.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsNoStrict.php deleted file mode 100644 index 546fce80..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsNoStrict.php +++ /dev/null @@ -1,34 +0,0 @@ -testField = $value; - } - - public function getTestField() - { - return $this->testField; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsWithoutGetter.php b/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsWithoutGetter.php deleted file mode 100644 index e766e802..00000000 --- a/bundled-libs/zendframework/zend-stdlib/test/TestAsset/TestOptionsWithoutGetter.php +++ /dev/null @@ -1,25 +0,0 @@ -foo = $value; - } -} diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/alpha b/bundled-libs/zendframework/zend-stdlib/test/_files/alpha deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/beta b/bundled-libs/zendframework/zend-stdlib/test/_files/beta deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/delta b/bundled-libs/zendframework/zend-stdlib/test/_files/delta deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/eta.alpha b/bundled-libs/zendframework/zend-stdlib/test/_files/eta.alpha deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/eta.beta b/bundled-libs/zendframework/zend-stdlib/test/_files/eta.beta deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/gamma b/bundled-libs/zendframework/zend-stdlib/test/_files/gamma deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/zeta.alpha b/bundled-libs/zendframework/zend-stdlib/test/_files/zeta.alpha deleted file mode 100644 index e69de29b..00000000 diff --git a/bundled-libs/zendframework/zend-stdlib/test/_files/zeta.beta b/bundled-libs/zendframework/zend-stdlib/test/_files/zeta.beta deleted file mode 100644 index e69de29b..00000000