Code Monkey home page Code Monkey logo

tdd7's People

Contributors

edward-murrell avatar

Stargazers

 avatar

Watchers

 avatar  avatar

tdd7's Issues

Table schemas are not honoured.

Currently it's possible to update & insert data into columns in the database mock that do not exist.

In the test case MockDatabaseTestUpdateCase::testDB_updateFieldthatDoesntExist(), the previously non-existent field 'foo' is updated, which is then found in the resulting output.

Acceptance criteria for this issue:

  1. Create a method on DatabaseConnection_unittest to specify table columns.
  2. Raise appropriate exceptions when the child functions of MockQuery::execute() attempt to perform operations on columns that do not exist.

Stretch goals:

  1. Create a method on DatabaseConnection_unittest to import standard drupal table schema directly for to set columns.
  2. Honour defaults in the database schema.
  3. Honour Null/Not Null directives in the database schema.

Order By needs to work for multiple columns

Currently order by does not work for multiple columns on db_select.
https://api.drupal.org/api/drupal/includes!database!select.inc/function/SelectQuery%3A%3AorderBy/7

As per https://www.drupal.org/node/278537, db_delete does not always support DELETE with ORDER & LIMIT.

Acceptance criteria for this issue:

  1. Update MockSelectQuery::orderBy() to work cleanly with multiple class on the same object.
  2. Fill out MockSelectQuery::getOrderByOrder()

Stretch goals:

  1. Add MockDeleteQuery::orderBy()

Mock db_select() without fields() does not generate same error as production code.

The following code will not error when used with the DatabaseConnection_unittest::db_select(), but will create errors on production;

   $item = db_select('commerce_line_item')
     ->condition('order_id', $order_id)
     ->condition('type', 'product')
     ->execute();

Without the fields() statement, this would produce the following SQL when using the DatabaseConnection_mysql connection class;
SELECT FROM commerce_line_item commerce_line_item WHERE order_id = 123 AND type = ‘product’;

The following code is handled by tdd7, but needs to be enforced as mandatory in the mock.

$item = db_select('commerce_line_item')
     ->condition('order_id', $order_id)
     ->fields('commerce_product', array('product_id', 'revision_id', 'sku')
     ->condition('type', 'product')
     ->execute();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.