public function getObjectsToValidate()
 {
     $validStatement = new Statement();
     $validStatement->setId('12345678-1234-5678-8234-567812345678');
     $validStatement->setActor(new Agent());
     $validStatement->setVerb(new Verb());
     $validStatement->setObject(new Activity());
     $statementWithoutId = new Statement();
     $statementWithoutId->setActor(new Agent());
     $statementWithoutId->setVerb(new Verb());
     $statementWithoutId->setObject(new Activity());
     $statementWithNonUuidId = new Statement();
     $statementWithNonUuidId->setId('foo');
     $statementWithNonUuidId->setActor(new Agent());
     $statementWithNonUuidId->setVerb(new Verb());
     $statementWithNonUuidId->setObject(new Activity());
     $statementWithoutActor = new Statement();
     $statementWithoutActor->setId('12345678-1234-5678-8234-567812345678');
     $statementWithoutActor->setVerb(new Verb());
     $statementWithoutActor->setObject(new Activity());
     $statementWithoutVerb = new Statement();
     $statementWithoutVerb->setId('12345678-1234-5678-8234-567812345678');
     $statementWithoutVerb->setActor(new Agent());
     $statementWithoutVerb->setObject(new Activity());
     $statementWithoutObject = new Statement();
     $statementWithoutObject->setId('12345678-1234-5678-8234-567812345678');
     $statementWithoutObject->setActor(new Agent());
     $statementWithoutObject->setVerb(new Verb());
     return array(array(StatementFixtures::getMinimalStatement(), 0), array($validStatement, 0), array($statementWithoutId, 1), array($statementWithNonUuidId, 1), array($statementWithoutActor, 1), array($statementWithoutVerb, 1), array($statementWithoutObject, 1));
 }
 /**
  * Loads a statement result.
  *
  * @param string $urlPath An optional URL path refering to more results
  *
  * @return StatementResult
  */
 public static function getStatementResult($urlPath = null)
 {
     $statement1 = StatementFixtures::getMinimalStatement();
     $verb = new Verb('http://adlnet.gov/expapi/verbs/deleted', array('en-US' => 'deleted'));
     $statement2 = new Statement('12345678-1234-5678-8234-567812345679', new Agent('mailto:bob@example.com'), $verb, $statement1->getObject());
     $statementResult = new StatementResult(array($statement1, $statement2), $urlPath);
     return $statementResult;
 }
 /**
  * Loads a statement result.
  *
  * @param IRL $urlPath An optional URL path refering to more results
  *
  * @return StatementResult
  */
 public static function getStatementResult(IRL $urlPath = null)
 {
     $statement1 = StatementFixtures::getMinimalStatement();
     $verb = new Verb(IRI::fromString('http://adlnet.gov/expapi/verbs/deleted'), LanguageMap::create(array('en-US' => 'deleted')));
     $statement2 = new Statement(StatementId::fromString('12345678-1234-5678-8234-567812345679'), new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:bob@example.com'))), $verb, $statement1->getObject());
     $statementResult = new StatementResult(array($statement1, $statement2), $urlPath);
     return $statementResult;
 }
 public function testSaveWithoutFlush()
 {
     $statement = StatementFixtures::getMinimalStatement();
     $self = $this;
     $this->mappedStatementRepository->expects($this->once())->method('storeMappedStatement')->with($this->callback(function (MappedStatement $mappedStatement) use($self, $statement) {
         return $self->assertMappedStatement(MappedStatement::createFromModel($statement), $mappedStatement);
     }), false);
     $this->statementRepository->storeStatement($statement, false);
 }
 public function testSaveWithoutFlush()
 {
     $statement = StatementFixtures::getMinimalStatement();
     $this->mappedStatementRepository->expects($this->once())->method('storeStatement')->with($this->callback(function (MappedStatement $mappedStatement) use($statement) {
         $expected = MappedStatement::fromModel($statement);
         $actual = clone $mappedStatement;
         $actual->stored = null;
         return $expected == $actual;
     }), false);
     $this->statementRepository->storeStatement($statement, false);
 }
 public function testCallToFlushCanBeSuppressed()
 {
     $this->objectManager->expects($this->never())->method('flush');
     $mappedStatement = MappedStatement::createFromModel(StatementFixtures::getMinimalStatement());
     $this->repository->storeMappedStatement($mappedStatement, false);
 }
 /**
  * @param int $id
  *
  * @return Statement
  */
 private function createStatement($id = null)
 {
     return StatementFixtures::getMinimalStatement($id);
 }
 public function getObjectsToValidate()
 {
     return array(array(StatementFixtures::getMinimalStatement(), 0), array(StatementFixtures::getTypicalStatement(), 0));
 }
 public function statementProvider()
 {
     return array('minimal-statement' => array(StatementJsonFixtures::getMinimalStatement(), StatementFixtures::getMinimalStatement()), 'statement-reference' => array(StatementJsonFixtures::getStatementWithStatementRef(), StatementFixtures::getStatementWithStatementRef()), 'statement-with-sub-statement' => array(StatementJsonFixtures::getStatementWithSubStatement(), StatementFixtures::getStatementWithSubStatement()), 'statement-with-result' => array(StatementJsonFixtures::getStatementWithResult(), StatementFixtures::getStatementWithResult()), 'statement-with-agent-authority' => array(StatementJsonFixtures::getStatementWithAgentAuthority(), StatementFixtures::getStatementWithAgentAuthority()), 'statement-with-group-authority' => array(StatementJsonFixtures::getStatementWithGroupAuthority(), StatementFixtures::getStatementWithGroupAuthority()));
 }
 private function getStatements($id)
 {
     return array('minimal-statement' => array(StatementFixtures::getMinimalStatement($id)), 'statement-with-group-actor' => array(StatementFixtures::getStatementWithGroupActor($id)), 'statement-with-group-actor-without-members' => array(StatementFixtures::getStatementWithGroupActorWithoutMembers($id)), 'object-is-statement-reference' => array(StatementFixtures::getStatementWithStatementRef($id)), 'statement-with-result' => array(StatementFixtures::getStatementWithResult($id)), 'statement-with-agent-authority' => array(StatementFixtures::getStatementWithAgentAuthority($id)), 'statement-with-group-authority' => array(StatementFixtures::getStatementWithGroupAuthority($id)));
 }
 public function testSerializeMinimalStatement()
 {
     $statement = StatementFixtures::getMinimalStatement();
     $this->assertJsonEquals(StatementJsonFixtures::getMinimalStatement(), $this->statementSerializer->serializeStatement($statement));
 }
Exemplo n.º 12
0
 /**
  * @param int $id
  *
  * @return Statement
  */
 private function createStatement($id = null)
 {
     $statement = StatementFixtures::getMinimalStatement($id);
     if (null === $id) {
         $statement = $statement->withId(null);
     }
     return $statement;
 }
 public function getObjectsToValidate()
 {
     $validStatement = new Statement('12345678-1234-5678-8234-567812345678', new Agent(), new Verb('the-verb-id'), new Activity());
     $statementWithNonUuidId = new Statement('foo', new Agent(), new Verb('the-verb-id'), new Activity());
     return array(array(StatementFixtures::getMinimalStatement(), 0), array($validStatement, 0), array($statementWithNonUuidId, 1));
 }