-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f218b77
commit 76c3153
Showing
8 changed files
with
125 additions
and
81 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
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,40 @@ | ||
// @copyright 2017-2018 zzu_softboy <zzu_softboy@163.com> | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. | ||
// | ||
// Created by softboy on 2017/11/02. | ||
|
||
#include "ConstantTestcases.h" | ||
|
||
namespace dummyext | ||
{ | ||
|
||
using zapi::lang::Constant; | ||
using zapi::lang::Namespace; | ||
|
||
void register_constant_testcases(Extension &extension) | ||
{ | ||
extension.registerConstant(Constant("MY_CONST", 12333)); | ||
extension.registerConstant(Constant("PI", 3.14)); | ||
Constant nameConst("ZAPI_NAME", "zapi"); | ||
extension.registerConstant(nameConst); | ||
extension.registerConstant(Constant("ZAPI_VERSION", "v0.0.1")); | ||
extension.registerConstant(Constant("QIHOO", "beijing qihoo")); | ||
// register constant in namespace | ||
Namespace *zapi = extension.findNamespace("zapi"); | ||
Namespace *io = zapi->findNamespace("io"); | ||
io->registerConstant(Constant("IO_TYPE", "ASYNC")); | ||
io->registerConstant(Constant("NATIVE_STREAM", true)); | ||
zapi->registerConstant(Constant("SYS_VERSION", "0.1.1-alpha")); | ||
} | ||
|
||
} // dummyext |
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,30 @@ | ||
// @copyright 2017-2018 zzu_softboy <zzu_softboy@163.com> | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. | ||
// | ||
// Created by softboy on 2017/11/02. | ||
|
||
#ifndef ZAPI_TEST_DUMMYEXT_CONSTANT_TESTCASES_H | ||
#define ZAPI_TEST_DUMMYEXT_CONSTANT_TESTCASES_H | ||
|
||
#include "zapi/ZendApi.h" | ||
|
||
namespace dummyext | ||
{ | ||
|
||
using zapi::lang::Extension; | ||
|
||
ZAPI_DECL_EXPORT void register_constant_testcases(Extension &extension); | ||
|
||
} // dummyext | ||
|
||
#endif // ZAPI_TEST_DUMMYEXT_CONSTANT_TESTCASES_H |
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 |
---|---|---|
@@ -1,37 +1,31 @@ | ||
--TEST-- | ||
Contant register test | ||
--FILE-- | ||
<?php | ||
|
||
if(defined("MY_CONST")) | ||
if(!defined("MY_CONST")) | ||
{ | ||
echo "MY_CONST defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("PI")) | ||
if(!defined("PI")) | ||
{ | ||
echo "PI defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("ZAPI_NAME")) | ||
if(!defined("ZAPI_NAME")) | ||
{ | ||
echo "ZAPI_NAME defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("ZAPI_VERSION")) | ||
if(!defined("ZAPI_VERSION")) | ||
{ | ||
echo "ZAPI_NAME defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("QIHOO")) | ||
if(!defined("QIHOO")) | ||
{ | ||
echo "QIHOO defined\n"; | ||
goto error; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
MY_CONST defined | ||
PI defined | ||
ZAPI_NAME defined | ||
ZAPI_NAME defined | ||
QIHOO defined | ||
success: | ||
exit(0); | ||
error: | ||
exit(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 |
---|---|---|
@@ -1,25 +1,21 @@ | ||
--TEST-- | ||
Contant namespace exist test | ||
--FILE-- | ||
<?php | ||
|
||
if(defined("\zapi\SYS_VERSION")) | ||
if(!defined("\zapi\SYS_VERSION")) | ||
{ | ||
echo "\zapi\SYS_VERSION defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("\zapi\io\IO_TYPE")) | ||
if(!defined("\zapi\io\IO_TYPE")) | ||
{ | ||
echo "\zapi\io\IO_TYPE defined\n"; | ||
goto error; | ||
} | ||
|
||
if(defined("\zapi\io\NATIVE_STREAM")) | ||
if(!defined("\zapi\io\NATIVE_STREAM")) | ||
{ | ||
echo "\zapi\io\NATIVE_STREAM defined\n"; | ||
goto error; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
\zapi\SYS_VERSION defined | ||
\zapi\io\IO_TYPE defined | ||
\zapi\io\NATIVE_STREAM defined | ||
success: | ||
exit(0); | ||
error: | ||
exit(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 |
---|---|---|
@@ -1,71 +1,46 @@ | ||
--TEST-- | ||
Contant type test | ||
--FILE-- | ||
<?php | ||
|
||
if(defined("MY_CONST")) | ||
if(!defined("MY_CONST") || !is_int(MY_CONST)) | ||
{ | ||
if (is_int(MY_CONST)) { | ||
echo "MY_CONST is int\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("PI")) | ||
if(!defined("PI") || !is_double(PI)) | ||
{ | ||
if (is_double(PI)) { | ||
echo "PI is double\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("ZAPI_NAME")) | ||
if(!defined("ZAPI_NAME") || !is_string(ZAPI_NAME)) | ||
{ | ||
if (is_string(ZAPI_NAME)) { | ||
echo "ZAPI_NAME is string\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("ZAPI_VERSION")) | ||
if(!defined("ZAPI_VERSION") || !is_string(ZAPI_VERSION)) | ||
{ | ||
if (is_string(ZAPI_VERSION)) { | ||
echo "ZAPI_VERSION is string\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("QIHOO")) | ||
if(!defined("QIHOO") || !is_string(QIHOO)) | ||
{ | ||
if (is_string(QIHOO)) { | ||
echo "QIHOO is string\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("\zapi\SYS_VERSION")) | ||
if(!defined("\zapi\SYS_VERSION") || !is_string(\zapi\SYS_VERSION)) | ||
{ | ||
if (is_string(\zapi\SYS_VERSION)) { | ||
echo "\zapi\SYS_VERSION is string\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("\zapi\io\IO_TYPE")) | ||
if(!defined("\zapi\io\IO_TYPE") || !is_string(\zapi\io\IO_TYPE)) | ||
{ | ||
if (is_string(\zapi\io\IO_TYPE)) { | ||
echo "\zapi\io\IO_TYPE is string\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
if(defined("\zapi\io\NATIVE_STREAM")) | ||
if(!defined("\zapi\io\NATIVE_STREAM") || !is_bool(\zapi\io\NATIVE_STREAM)) | ||
{ | ||
if (is_bool(\zapi\io\NATIVE_STREAM)) { | ||
echo "\zapi\io\NATIVE_STREAM is bool\n"; | ||
} | ||
goto error; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
MY_CONST is int | ||
PI is double | ||
ZAPI_NAME is string | ||
ZAPI_VERSION is string | ||
QIHOO is string | ||
\zapi\SYS_VERSION is string | ||
\zapi\io\IO_TYPE is string | ||
\zapi\io\NATIVE_STREAM is bool | ||
success: | ||
exit(0); | ||
error: | ||
exit(1); |