Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Add some new tests for quote. #1733

Merged
merged 1 commit into from Dec 22, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 79 additions & 0 deletions tests/suites/unit/joomla/database/JDatabaseTest.php
Expand Up @@ -429,6 +429,85 @@ public function testQuote()
);
}

/**
* Tests the JDatabase::quote method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteBooleanTrue()
{
$this->assertThat(
$this->db->quote(true),
$this->equalTo("'-1-'"),
'Tests handling of boolean true with escaping (default).'
);
}

/**
* Tests the JDatabase::quote method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteBooleanFalse()
{
$this->assertThat(
$this->db->quote(false),
$this->equalTo("'--'"),
'Tests handling of boolean false with escaping (default).'
);
}

/**
* Tests the JDatabase::quote method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteNull()
{
$this->assertThat(
$this->db->quote(null),
$this->equalTo("'--'"),
'Tests handling of null with escaping (default).'
);
}
/**
* Tests the JDatabase::quote method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteInteger()
{
$this->assertThat(
$this->db->quote(42),
$this->equalTo("'-42-'"),
'Tests handling of integer with escaping (default).'
);
}

/**
* Tests the JDatabase::quote method.
*
* @return void
*
* @since 11.4
*/
public function testQuoteFloat()
{
$this->assertThat(
$this->db->quote(3.14),
$this->equalTo("'-3.14-'"),
'Tests handling of float with escaping (default).'
);
}

/**
* Tests the JDatabase::quoteName method.
*
Expand Down