!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/php/3ros/shindig/test/social/   drwxr-xr-x
Free 14.54 GB of 61.93 GB (23.48%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     JsonDbOpensocialServiceTest.php (7.91 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

/**
 * JsonDbOpensocialService test case.
 */
class JsonDbOpensocialServiceTest extends PHPUnit_Framework_TestCase {
  
  
/**
   * @var JsonDbOpensocialService
   */
  
private $service;

  
/**
   * Prepares the environment before running a test.
   */
  
protected function setUp() {
    
parent::setUp();
    
$this->service = new JsonDbOpensocialService();
  }

  
/**
   * Cleans up the environment after running a test.
   */
  
protected function tearDown() {
    
$this->service null;
    
parent::tearDown();
  }

  
/**
   * Constructs the test case.
   */
  
public function __construct() {}

  
/**
   * Tests JsonDbOpensocialService->getActivities() with paging.
   */
  
public function testGetActivities() {
    
$token BasicSecurityToken::createFromValues('jane.doe''jane.doe'1111'default');
    
$userId = new UserId('owner'null);
    
$userIds = array($userId);
    
$groupId = new GroupId('self'null);
    
$startIndex 1;
    
$count 1;
    
    
$ret $this->service->getActivities($userIds$groupId1nullnullnullnull$startIndex$countnull1$token);
    
$this->assertEquals($startIndex$ret->startIndex);
    
$this->assertEquals($countcount($ret->entry));
    
$this->assertEquals(2$ret->totalResults);
    
$this->assertEquals('2'$ret->entry[0]['id']);
    
$this->assertEquals('Jane says George likes yoda!'$ret->entry[0]['title']);
    
$this->assertEquals('or is it you?'$ret->entry[0]['body']);
  }
  
  public function 
testActivityLifeCycle() {
    
$token BasicSecurityToken::createFromValues('jane.doe''jane.doe'1111'default');
    
$userId = new UserId('owner'null);
    
$userIds = array($userId);
    
$groupId = new GroupId('self'null);
    
$title 'activity life cycle unit test title';
    
$activity = array('id' => '1''userId' => 'userId''title' => $title);
    
$ret $this->service->getActivities($userIds$groupId1nullnullnullnull04null1$token);
    
$this->assertEquals(2count($ret->entry));
    
    
$this->service->createActivity($userId$groupId$token->getAppId(), null$activity$token);
    
$ret $this->service->getActivities($userIds$groupId1nullnullnullnull04null1$token);
    
$this->assertEquals(3count($ret->entry));
    
$id null;
    foreach (
$ret->entry as $entity) {
      if (
$entity['title'] == $title) {
        
$id $entity['id'];
      }
    }
    
$this->assertNotNull($id);
    
    
$this->service->deleteActivities($userId$groupId$token->getAppId(), array($id), $token);
    
    
$ret $this->service->getActivities($userIds$groupId1nullnullnullnull04null1$token);
    
$this->assertEquals(2count($ret->entry));
  }

  public function 
testMessageLifeCycle() {
    
$token BasicSecurityToken::createFromValues('john.doe''canonical'1111'default');
    
$userId = new UserId('viewer'null);
    
$body 'message unit test body';
    
$title 'message unit test title';
    
$message = array('id' => '1''body' => $body'title' => $title'type' => 'NOTIFICATION');
    
$ret $this->service->getMessages($userId'notification'nullnullnull$token);
    
$this->assertEquals(3count($ret->entry));
    
    
$this->service->createMessage($userId'notification'$message$token);
    
$ret $this->service->getMessages($userId'notification'nullnullnull$token);
    
$this->assertEquals(4count($ret->entry));
    
    
$fetchedMessage null;
    foreach (
$ret->entry as $message) {
      if (
$message['title'] == $title) {
        
$fetchedMessage $message;
      }
    }
    
$this->assertEquals($body$fetchedMessage['body']);
    
    
$this->service->deleteMessages($userId'notification', array($fetchedMessage['id']), $token);
    
$ret $this->service->getMessages($userId'notification'nullnullnull$token);
    
$this->assertEquals(3count($ret->entry));
  }
  
  public function 
testGetMessages() {
    
$token BasicSecurityToken::createFromValues('canonical''canonical'1111'default');
    
$userId = new UserId('viewer'null);
    
$options = new CollectionOptions();
    
$options->setCount(2);
    
$options->setStartIndex(1);
    
$ret $this->service->getMessages($userId'notification'Message::$DEFAULT_FIELDS, array('1''2''3'), $options$token);
    
    
$this->assertEquals(2count($ret->entry));
    
$this->assertEquals('2'$ret->entry[0]['id']);
    
$this->assertEquals('notification'$ret->entry[0]['type']);
    
$this->assertEquals('play checkers'$ret->entry[0]['title']);
    
    
$this->assertEquals('3'$ret->entry[1]['id']);
    
    
$this->assertEquals('you won!'$ret->entry[1]['title']);
  }
  
  public function 
testMessageCollectionLifeCycle() {
    
// NOTE: If this method failes after the creation of the market collection.
    // There will be a market collection in the cached json file /tmp/ShindigDb.json
    // that prevents the test from passing. Change the test case and remove that
    // file then run again.
    
$token BasicSecurityToken::createFromValues('john.doe''john.doe'1111'default');
    
$title 'created for message collection unit test';
    
$userId = new UserId('owner'null);
    
$msgColl = array('id' => '1''title' => $title);
    
$this->service->createMessageCollection($userId$msgColl$token);
    
    
$msgColls $this->service->getMessageCollections($userIdnullnull$token)->entry;
    
$this->assertEquals(4count($msgColls));
    
$fetchedMsgColl null;
    foreach (
$msgColls as $coll) {
      if (
$coll['title'] == $title) {
        
$fetchedMsgColl $coll;
      }
    }
    
$this->assertNotNull($fetchedMsgColl);
    
    
$newTitle 'new title for unit test';
    
$msgColl['title'] = $newTitle;
    
$msgColl['id'] = $fetchedMsgColl['id'];
    
$this->service->updateMessageCollection($userId$msgColl$token);
    
    
$msgColls $this->service->getMessageCollections($userIdnullnull$token)->entry;
    
$this->assertEquals(4count($msgColls));
    foreach (
$msgColls as $coll) {
      if (
$coll['id'] == $fetchedMsgColl['id']) {
        
$fetchedMsgColl $coll;
      }
    }
    
$this->assertEquals($newTitle$fetchedMsgColl['title']);
    
    
$this->service->deleteMessageCollection($userId$fetchedMsgColl['id'], $token);
    
$msgColls $this->service->getMessageCollections($userIdnullnull$token)->entry;
    
$this->assertEquals(3count($msgColls));    
  }
  
  public function 
testGetMessageCollections() {
    
$token BasicSecurityToken::createFromValues('john.doe''john.doe'1111'default');
    
$userId = new UserId('owner'null);
    
$ret $this->service->getMessageCollections($userIdMessageCollection::$DEFAULT_FIELDSnull$token);
    
$this->assertEquals('Notifications'$ret->entry[0]['title']);
    
$this->assertEquals('notification'$ret->entry[0]['id']);
    
$this->assertEquals(2$ret->entry[0]['total']);
    
    
$this->assertEquals('Inbox'$ret->entry[1]['title']);
    
$this->assertEquals('privateMessage'$ret->entry[1]['id']);
    
$this->assertEquals(0$ret->entry[1]['total']);
    
    
$this->assertEquals('Inbox'$ret->entry[2]['title']);
    
$this->assertEquals('publicMessage'$ret->entry[2]['id']);
    
$this->assertEquals(0$ret->entry[2]['total']);
  }
  
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.5908 ]--