Skip to content

Commit 7348cc1

Browse files
authored
Move working tests up a folder (#503)
Tests in the experimental/ folder were not executed on CI. The ones that work move up, the few that remain in experimental/ need further investigation to get working or remove.
1 parent 5833590 commit 7348cc1

35 files changed

+190
-150
lines changed

Diff for: tests/experimental/add_bykey.phpt renamed to tests/add_bykey.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::addByKey()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$m->delete('foo');
@@ -15,7 +15,7 @@ echo $m->getResultMessage(), "\n";
1515
var_dump($m->addByKey('foo', '', 1, 10));
1616
echo $m->getResultMessage(), "\n";
1717
// This is OK for the binary protocol
18-
$rv = $m->addByKey('foo', ' asd åäö', 1, 1);
18+
$rv = $m->addByKey('foo', ' asd åäö', 1, 1);
1919
if ($m->getOption(Memcached::OPT_BINARY_PROTOCOL)) {
2020
if ($rv !== true and $m->getResultCode() !== Memcached::RES_SUCCESS) {
2121
var_dump($rv);

Diff for: tests/experimental/addserver_unixdomain.phpt renamed to tests/addserver_unixdomain.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Memcached::addServer() unix doamin socket
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--CLEAN--
66
<?php
77
unlink('/tmp/memc_test_unix_socket');

Diff for: tests/experimental/append_bykey.phpt renamed to tests/append_bykey.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::appendByKey()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99
$m->setOption(Memcached::OPT_COMPRESSION, false);
1010

Diff for: tests/experimental/cas_bykey.phpt renamed to tests/cas_bykey.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::casByKey()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$m->delete('cas_test');

Diff for: tests/experimental/cas_invalid_key.phpt renamed to tests/cas_invalid_key.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
--TEST--
22
Memcached::cas() with strange key
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
error_reporting(0);
1111
var_dump($m->cas(0, '', true, 10));
1212
echo $m->getResultMessage(), "\n";
1313

14-
var_dump($m->cas(0, ' äö jas kjjhask d ', true, 10)); # no spaces allowed
14+
var_dump($m->cas(0, ' äö jas kjjhask d ', true, 10)); # no spaces allowed
1515
echo $m->getResultMessage(), "\n";
1616

1717
--EXPECTF--

Diff for: tests/experimental/delete_bykey.phpt renamed to tests/delete_bykey.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::deleteByKey()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$m->setByKey('keffe', 'eisaleeoo', "foo");
@@ -21,7 +21,7 @@ var_dump($m->deleteByKey('keffe', ''));
2121
echo $m->getResultMessage(), "\n";
2222
var_dump($m->deleteByKey('', 'keffe'));
2323
echo $m->getResultMessage(), "\n";
24-
var_dump($m->deleteByKey('keffe', 'äöåasäö åaösdäf asdf')); # no spaces allowed
24+
var_dump($m->deleteByKey('keffe', 'äöåasäö åaösdäf asdf')); # no spaces allowed
2525
echo $m->getResultMessage(), "\n";
2626
--EXPECTF--
2727
string(3) "foo"

Diff for: tests/experimental/deletemulti_nonstringkeys.phpt renamed to tests/deletemulti_nonstringkeys.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Delete multi with integer keys
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$data = array(

Diff for: tests/experimental/get_bykey_cas.phpt

-70
This file was deleted.

Diff for: tests/experimental/fetch.phpt renamed to tests/fetch.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Memcached getDelayed() and fetch() with and without cas
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
77

@@ -33,7 +33,7 @@ function simple_compare(array $data, array $actual, $has_cas) {
3333
}
3434

3535

36-
include dirname(dirname(__FILE__)) . '/config.inc';
36+
include dirname(__FILE__) . '/config.inc';
3737
$m = memc_get_instance ();
3838

3939
$data = array(

Diff for: tests/experimental/fetch_badunserialize.phpt renamed to tests/fetch_badunserialize.phpt

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::fetch() with bad unserialize
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
class Foo implements Serializable {
@@ -31,6 +31,17 @@ class Foo implements Serializable {
3131
public function unserialize($str) {
3232
throw new Exception("123456");
3333
}
34+
35+
public function __serialize() {
36+
if ($this->serialize_throws) {
37+
throw new Exception("1234");
38+
}
39+
return ["1234"];
40+
}
41+
42+
public function __unserialize($str) {
43+
throw new Exception("123456");
44+
}
3445
}
3546

3647
$data = new Foo();

Diff for: tests/experimental/fetchall_badunserialize.phpt renamed to tests/fetchall_badunserialize.phpt

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::fetch() with bad unserialize
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
class Foo implements Serializable {
@@ -31,6 +31,17 @@ class Foo implements Serializable {
3131
public function unserialize($str) {
3232
throw new Exception("123456");
3333
}
34+
35+
public function __serialize() {
36+
if ($this->serialize_throws) {
37+
throw new Exception("1234");
38+
}
39+
return ["1234"];
40+
}
41+
42+
public function __unserialize($str) {
43+
throw new Exception("123456");
44+
}
3445
}
3546

3647
$data = new Foo();

Diff for: tests/experimental/get.phpt renamed to tests/get.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::get()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$m->delete('foo');
@@ -20,7 +20,7 @@ var_dump($m->get('foo'));
2020
echo $m->getResultMessage(), "\n";
2121

2222
$m->delete('foo');
23-
var_dump($m->get(' ä foo jkh a s åäö'));
23+
var_dump($m->get(' ä foo jkh a s åäö'));
2424
echo $m->getResultMessage(), "\n";
2525
--EXPECT--
2626
bool(false)

Diff for: tests/experimental/get_bykey.phpt renamed to tests/get_bykey.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
22
Memcached::getByKey()
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
7-
include dirname(dirname(__FILE__)) . '/config.inc';
7+
include dirname(__FILE__) . '/config.inc';
88
$m = memc_get_instance ();
99

1010
$m->set('foo', 1, 10);
@@ -20,7 +20,7 @@ var_dump($m->getByKey('foo', 'bar'));
2020
echo $m->getResultMessage(), "\n";
2121

2222
$m->delete('foo');
23-
var_dump($m->getByKey(' ä foo jkh a s åäö', 'foo'));
23+
var_dump($m->getByKey(' ä foo jkh a s åäö', 'foo'));
2424
echo $m->getResultMessage(), "\n";
2525

2626
--EXPECTF--

Diff for: tests/get_bykey_cas.phpt

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
--TEST--
2+
Memcached::getByKey() with CAS
3+
--SKIPIF--
4+
<?php include "skipif.inc";?>
5+
--FILE--
6+
<?php
7+
include dirname(__FILE__) . '/config.inc';
8+
$m = memc_get_instance ();
9+
10+
function the_callback(Memcached $memc, $key, &$value) {
11+
echo "called\n";
12+
$value = "1234";
13+
return true;
14+
}
15+
16+
$m->set('foo', 1, 10);
17+
18+
$v = $m->getByKey('foo', 'foo', null, Memcached::GET_EXTENDED);
19+
var_dump($v['value']);
20+
var_dump($v['cas']);
21+
echo $m->getResultMessage(), "\n";
22+
23+
$v = $m->getByKey('', 'foo', null, Memcached::GET_EXTENDED);
24+
var_dump($v['value']);
25+
var_dump($v['cas']);
26+
echo $m->getResultMessage(), "\n";
27+
28+
$m->set('bar', "asdf", 10);
29+
30+
$v = $m->getByKey('foo', 'bar', null, Memcached::GET_EXTENDED);
31+
var_dump($v['value']);
32+
var_dump($v['cas']);
33+
echo $m->getResultMessage(), "\n";
34+
35+
$m->delete('foo');
36+
var_dump($m->getByKey(' ä foo jkh a s åäö', 'foo', null, Memcached::GET_EXTENDED));
37+
echo $m->getResultMessage(), "\n";
38+
39+
var_dump($m->getByKey(' ä foo jkh a s åäö', '', null, Memcached::GET_EXTENDED));
40+
echo $m->getResultMessage(), "\n";
41+
42+
$m->delete('foo');
43+
var_dump($m->getByKey('foo', 'foo', 'the_callback', Memcached::GET_EXTENDED));
44+
var_dump($m->getByKey('foo', 'foo'));
45+
--EXPECTF--
46+
int(1)
47+
int(%d)
48+
SUCCESS
49+
int(1)
50+
int(%d)
51+
SUCCESS
52+
string(4) "asdf"
53+
int(%d)
54+
SUCCESS
55+
bool(false)
56+
NOT FOUND
57+
bool(false)
58+
A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE
59+
called
60+
bool(false)
61+
bool(false)

Diff for: tests/experimental/getdelayed_badserver.phpt renamed to tests/getdelayed_badserver.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Memcached::getDelayedByKey() with bad server
33
--SKIPIF--
4-
<?php include dirname(dirname(__FILE__)) . "/skipif.inc";?>
4+
<?php include "skipif.inc";?>
55
--FILE--
66
<?php
77
$m = new Memcached();

0 commit comments

Comments
 (0)