-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1256 from sjinks/tests
Regression Tests
- Loading branch information
Showing
24 changed files
with
415 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ext/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ext/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ext/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[a] | ||
a_1 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[a] | ||
a_2 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Phalcon + PHP-FPM = segfault - https://github.com/phalcon/cphalcon/issues/1000 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
class Issue1000 extends \Phalcon\Config | ||
{ | ||
private $_section; | ||
|
||
public function __construct($file, $section = null) | ||
{ | ||
$this->_section = $section; | ||
} | ||
} | ||
|
||
$t1 = new Issue1000('test'); | ||
$t2 = new Issue1000('test', 'test'); | ||
?> | ||
--EXPECT-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Phalcon\Element::addFilter() prepends inserts NULL as the first element - https://github.com/phalcon/cphalcon/issues/1018 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); | ||
--FILE-- | ||
<?php | ||
$di = new \Phalcon\DI\FactoryDefault(); | ||
$form = new \Phalcon\Forms\Form(); | ||
$email = new \Phalcon\Forms\Element\Text('email'); | ||
$email->addValidator(new \Phalcon\Validation\Validator\Email()); | ||
$email->addFilter('trim'); | ||
$form->add($email); | ||
$data = array('email' => '[email protected]'); | ||
assert($form->isValid($data)); | ||
?> | ||
--EXPECT-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Phalcon\Config::merge does not work with derived classes - https://github.com/phalcon/cphalcon/issues/1024 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$config1 = new \Phalcon\Config\Adapter\Ini(__DIR__ . '/config/1024-a.ini'); | ||
$config2 = new \Phalcon\Config\Adapter\Ini(__DIR__ . '/config/1024-b.ini'); | ||
$config1->merge($config2); | ||
print_r($config1->toArray()); | ||
?> | ||
--EXPECT-- | ||
Array | ||
( | ||
[a] => Array | ||
( | ||
[a_1] => 1 | ||
[a_2] => 1 | ||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
Phalcon\Forms\Form::label() extra param - https://github.com/phalcon/cphalcon/issues/1029 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$form = new \Phalcon\Forms\Form(); | ||
$form->add(new \Phalcon\Forms\Element\Text("name")); | ||
$telephone = new \Phalcon\Forms\Element\Text("telephone"); | ||
$telephone->setLabel("The Telephone"); | ||
$form->add($telephone); | ||
echo $form->label('name', array('class' => 'form-control')), PHP_EOL; | ||
echo $form->label('telephone', array('class' => 'form-control')), PHP_EOL; | ||
?> | ||
--EXPECT-- | ||
<label for="name" class="form-control">name</label> | ||
<label for="telephone" class="form-control">The Telephone</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Phalcon\Http\Request::getRawBody() empties the raw body content - https://github.com/phalcon/cphalcon/issues/1091 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--POST-- | ||
{"query":[["george","alan", "thomas"]]} | ||
--FILE-- | ||
<?php | ||
$request = new \Phalcon\Http\Request(); | ||
var_dump($request->getRawBody(), $request->getRawBody()); | ||
?> | ||
--EXPECT-- | ||
string(39) "{"query":[["george","alan", "thomas"]]}" | ||
string(39) "{"query":[["george","alan", "thomas"]]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--TEST-- | ||
\Phalcon\Debug and russian language - https://github.com/phalcon/cphalcon/issues/1099 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$d = new \Phalcon\Debug(); | ||
$d->listen(true, true); | ||
throw new \Exception('Тест'); | ||
?> | ||
--EXPECTREGEX-- | ||
^.*?<meta http-equiv="Content-Type" content="text\/html; charset=utf-8"\/>.*$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--TEST-- | ||
Use recommended reason phrases for redirect - https://github.com/phalcon/cphalcon/issues/1175 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$di = new \Phalcon\DI\FactoryDefault(); | ||
$response = new \Phalcon\Http\Response(); | ||
$response->setDI($di); | ||
|
||
$response->resetHeaders(); | ||
$response->redirect("some/local/uri"); | ||
$h = $response->getHeaders(); | ||
echo $h->get('Status'), PHP_EOL; | ||
|
||
$response->resetHeaders(); | ||
$response->redirect("http://google.com", true); | ||
$h = $response->getHeaders(); | ||
echo $h->get('Status'), PHP_EOL; | ||
|
||
$response->resetHeaders(); | ||
$response->redirect("http://google.com", true, 301); | ||
$h = $response->getHeaders(); | ||
echo $h->get('Status'), PHP_EOL; | ||
|
||
for ($i=300; $i<310; ++$i) { | ||
$response->resetHeaders(); | ||
$response->redirect("http://google.com", true, $i); | ||
$h = $response->getHeaders(); | ||
echo $h->get('Status'), PHP_EOL; | ||
} | ||
?> | ||
--EXPECT-- | ||
302 Found | ||
302 Found | ||
301 Moved Permanently | ||
300 Multiple Choices | ||
301 Moved Permanently | ||
302 Found | ||
303 See Other | ||
304 Not Modified | ||
305 Use Proxy | ||
306 Switch Proxy | ||
307 Temporary Redirect | ||
308 Permanent Redirect | ||
309 Redirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Form.render doesn't escape value attributes on TextFields - https://github.com/phalcon/cphalcon/issues/1190 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$object = new stdClass(); | ||
$object->title = 'Hello "world!"'; | ||
$form = new \Phalcon\Forms\Form($object); | ||
$form->add(new \Phalcon\Forms\Element\Text("title")); | ||
echo $form->render('title'), PHP_EOL; | ||
?> | ||
--EXPECT-- | ||
<input type="text" value="Hello "world!"" name="title" id="title" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
--TEST-- | ||
Possibly Incorrect Behavior of Phalcon\Config::merge() - https://github.com/phalcon/cphalcon/issues/731 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$a = new \Phalcon\Config(array('aaa' => array('b' => 2, 'c' => 3))); | ||
$b = new \Phalcon\Config(array('aaa' => array('a' => 10, 'c' => 30, 'd' => 40))); | ||
$c = array('aaa' => array('b' => 2, 'c' => 30, 'a' => 10, 'd' => 40)); | ||
$a->merge($b); | ||
print_r($a->toArray()); | ||
print_r($c); | ||
echo PHP_EOL; | ||
|
||
$a = new \Phalcon\Config(array('aab' => (object)array('n' => 'm'))); | ||
$b = new \Phalcon\Config(array('aab' => array('x' => 'y'))); | ||
$c = array('aab' => array('x' => 'y')); | ||
$a->merge($b); | ||
print_r($a->toArray()); | ||
print_r($c); | ||
echo PHP_EOL; | ||
|
||
$a = new \Phalcon\Config(array('ab' => array('b' => 1, 'c' => 2))); | ||
$b = new \Phalcon\Config(array('ab' => array(0 => -10, 'c' => 20, 'd' => 30))); | ||
$c = array('ab' => array(0 => -10, 'c' => 2, 'd' => 30, 'b' => 1)); | ||
$b->merge($a); | ||
print_r($a->toArray()); | ||
print_r($c); | ||
echo PHP_EOL; | ||
|
||
$a = new \Phalcon\Config(array('ac' => array('b' => 1, 'c' => 2))); | ||
$b = new \Phalcon\Config(array('ac' => array(0 => -10, 'c' => 20, 'd' => 30))); | ||
$c = array('ac' => array(0 => -10, 'c' => 20, 'd' => 30, 'b' => 1)); | ||
$a->merge($b); | ||
print_r($a->toArray()); | ||
print_r($c); | ||
echo PHP_EOL; | ||
|
||
$a = new \Phalcon\Config(array('ad' => array(0 => 1, 1 => 2, 2 => 3))); | ||
$b = new \Phalcon\Config(array('ad' => array(1 => 20, 3 => 40))); | ||
$c = array('ad' => array(0 => 1, 1 => 20, 2 => 3, 3 => 40)); | ||
$a->merge($b); | ||
print_r($a->toArray()); | ||
print_r($c); | ||
echo PHP_EOL; | ||
?> | ||
--EXPECT-- | ||
Array | ||
( | ||
[aaa] => Array | ||
( | ||
[b] => 2 | ||
[c] => 30 | ||
[a] => 10 | ||
[d] => 40 | ||
) | ||
|
||
) | ||
Array | ||
( | ||
[aaa] => Array | ||
( | ||
[b] => 2 | ||
[c] => 30 | ||
[a] => 10 | ||
[d] => 40 | ||
) | ||
|
||
) | ||
|
||
Array | ||
( | ||
[aab] => Array | ||
( | ||
[x] => y | ||
) | ||
|
||
) | ||
Array | ||
( | ||
[aab] => Array | ||
( | ||
[x] => y | ||
) | ||
|
||
) | ||
|
||
Array | ||
( | ||
[ab] => Array | ||
( | ||
[b] => 1 | ||
[c] => 2 | ||
) | ||
|
||
) | ||
Array | ||
( | ||
[ab] => Array | ||
( | ||
[0] => -10 | ||
[c] => 2 | ||
[d] => 30 | ||
[b] => 1 | ||
) | ||
|
||
) | ||
|
||
Array | ||
( | ||
[ac] => Array | ||
( | ||
[b] => 1 | ||
[c] => 20 | ||
[0] => -10 | ||
[d] => 30 | ||
) | ||
|
||
) | ||
Array | ||
( | ||
[ac] => Array | ||
( | ||
[0] => -10 | ||
[c] => 20 | ||
[d] => 30 | ||
[b] => 1 | ||
) | ||
|
||
) | ||
|
||
Array | ||
( | ||
[ad] => Array | ||
( | ||
[0] => 1 | ||
[1] => 20 | ||
[2] => 3 | ||
[3] => 40 | ||
) | ||
|
||
) | ||
Array | ||
( | ||
[ad] => Array | ||
( | ||
[0] => 1 | ||
[1] => 20 | ||
[2] => 3 | ||
[3] => 40 | ||
) | ||
|
||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--TEST-- | ||
Phalcon\Config::offsetUnset() does not work - https://github.com/phalcon/cphalcon/issues/732 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$a = new Phalcon\Config(array('a' => 0)); | ||
assert(isset($a['a'])); | ||
unset($a['a']); | ||
assert(!isset($a['a'])); | ||
?> | ||
--EXPECT-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--TEST-- | ||
Invalid memory reads when GC is on - https://github.com/phalcon/cphalcon/pull/927 | ||
--SKIPIF-- | ||
<?php include('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$config = new \Phalcon\Config(array('test1' => 1, 'test2' => 2)); | ||
$config->merge(new \Phalcon\Config(array('test2'))); | ||
gc_collect_cycles(); | ||
?> | ||
--EXPECT-- |
Oops, something went wrong.