public function testSetFile()
 {
     $sut = new JsonSchema();
     self::assertNull($sut->getFile());
     $sut->setFile($expected = $this->schema->url());
     self::assertEquals($expected, $sut->getFile());
 }
 /**
  * @test
  */
 public function canWriteIntoLargeFile()
 {
     $fp = fopen($this->largeFile->url(), 'rb+');
     fseek($fp, 100 * 1024 * 1024, SEEK_SET);
     fwrite($fp, 'foobarbaz');
     fclose($fp);
     $this->largeFile->seek(100 * 1024 * 1024 - 3, SEEK_SET);
     $this->assertEquals('   foobarbaz   ', $this->largeFile->read(15));
 }
 /**
  * @test
  */
 public function createsHelloPhpRoute()
 {
     $routes = $this->routeLoader->load('.', 'legacy');
     $legacyRoute = $routes->get('basster.legacy.hello');
     $routePath = '/hello.php';
     self::assertNotNull($legacyRoute);
     self::assertEquals($routePath, $legacyRoute->getPath());
     self::assertEquals($this->legacyFile->url(), $legacyRoute->getDefault('legacyScript'));
     self::assertEquals($routePath, $legacyRoute->getDefault('requestPath'));
 }
예제 #4
0
 /**
  * @test
  */
 public function load_class_metadata_loads()
 {
     $root = vfsStream::setup();
     $root->addChild($file = new vfsStreamFile('mapping.xml'));
     $loader = new TestLoader($file->url());
     $this->assertTrue($loader->loadClassMetadata($this->prophesize('Kcs\\Metadata\\ClassMetadata')->reveal()));
 }
예제 #5
0
 public function testWritingATransactionWillSaveItToXMLFileAndIncrementTheTransactionSequenceNumber()
 {
     $this->sut->writeJournal($this->journal);
     $txnId = $this->sut->setJournalName(new StringType('Foo Journal'))->writeTransaction($this->createTransaction('0000', '00001', 12.26));
     $this->assertEquals(new IntType(1), $txnId);
     $expectedFileName = $this->root->url() . '/foo-journal.xml';
     $this->assertFileExists($expectedFileName);
     $testDom = new \DOMDocument();
     $testDom->load($expectedFileName);
     $textXpath = new \DOMXPath($testDom);
     //file has transaction
     $txn = $textXpath->query("/journal/transactions/transaction[@id='1']");
     $this->assertEquals(1, $txn->length);
     //inc === 1
     $inc = $textXpath->query('/journal/definition')->item(0)->attributes->getNamedItem('inc')->nodeValue;
     $this->assertEquals(1, intval($inc));
 }
 /**
  * @test
  */
 public function unlockSiteRemovesLockFlagFile()
 {
     $this->lockManager->unlockSite();
     $this->assertFileNotExists($this->mockLockFlagFile->url());
 }
예제 #7
0
 public function testBuildWillSaveCurrencyClassFileAndReturnFileContents()
 {
     $text = $this->sut->build();
     $this->assertFileExists($this->rootDir->url() . '/GBP.php');
     $this->assertEquals($text, file_get_contents($this->rootDir->url() . '/GBP.php'));
 }